I’ve written a jQuery plugin that accepts css colors for some of its parameters. I want to validate them. If it was just a hex or rgb value I could do that with a regular expression, but how do I validate all 147 valid color names without bloating the plugin? I was wondering if there is some way of attempting
Tag: css
Show child div on mouse hover of parent – needs javascript?
I need to show a div when you house over its parent (default is for the child div to be hidden). Is the only way to do this with javascript? Thanks Answer No JS required.
Fixed Positioned Div Inside another Div
I have one div position:fixed; and my problem is that position fixed is relatively to all the page, I need that the fixed div stays inside other div that is centered in the page with margins in auto.(So when I scroll down the page I want to see always the div in the same position). I use the jquery plugin
How do I detect “shift+enter” and generate a new line in Textarea?
Currently, if the person presses enter inside the text area, the form will submit. Good, I want that. But when they type shift + enter, I want the textarea to move to the next line: n How can I do that in JQuery or plain JavaScript as simple as possible? Answer Better use simpler solution: Tim’s solution below is better
Specify fallback font sizes in CSS?
Is there any way to specify different font sizes for fallback fonts in CSS? I want to do something like this (which obviously does not work): div { font-family: “Arial Narrow”, Arial, Helvetica, sans-serif; font-size: 20px, 18px, 18px, 18px; } The idea being that Arial Narrow would display at 20px if the user has it installed; if not, the browser
Is an empty iframe src valid?
I want an iframe to initially have src as blank and then once the page loads; call a JS function and then set the src value to an actual one.. So is <iframe src=”#” /> valid OR do I need to use something else like javascript:;, etc Answer just <iframe src=’about:blank’></iframe>
Best way to share constants between Javascript & CSS
I’m creating a website with lots of dynamic stuff laid out in javascript, as well as CSS. What’s bothering me is that half of my dimension constants (positions and sizes of things on the page) are in my javascript, whereas others are in my CSS. Is there a good way to have a “single place” for constants like this? First
Do tags only go in the tag?
Is it possible/good practice to use <link href””> to include stylesheets outside of the <head> tag, or do they only work / should they be only used in <head>? Answer It’s possible to do it. It’s not recommended to do it, because whatever content comes before the <link> will start rendering and then when the stylesheet is loaded will be
Change CSS of class in Javascript?
I’ve got a class with the display set to none I’d like to in Javascript now set it to inline I’m aware I can do this with an id with getElementById but what’s the cleanest way to do it with a class? Answer You can do that — actually change style rules related to a class — using the styleSheets array (MDN
Expand Image Vertically Without Disrupting the Flow with Javascript & CSS
My Progress is @ http://codebucket.webatu.com/code/portfoliotest/index.html Code on JSfiddle: http://jsfiddle.net/warmlaundry/qJbG4/70/ I want to make the edges of the ‘f’ and ‘l’ stretch to the edge of the page. I’m just expanding the height of two images that sandwich the word. I want the word itself to stay put, and I don’t want the expanding images to displace any other elements. Is