Why does HTML think “chucknorris” is a Color? How come certain random strings produce colors when entered as background colors in HTML? For example: <body bgcolor="chucknorris"> test </body> ...produces a document with a red background across all browsers and platforms. Interestingly, while chucknorri produces a red background as well, chucknorr produces a yellow background. What's going on here? Answer : It's a holdover from the Netscape days: Missing digits are treated as 0[...]. An incorrect digit is simply interpreted as 0. For example the values
undefined
How do I position one image on top of another in HTML? I'm a beginner at rails programming, attempting to show many images on a page. Some images are to lay on top of others. To make it simple, say I want a blue square, with a red square in the upper right corner of the blue square (but not tight in the corner). I am trying to avoid compositing (with ImageMagick and similar) due to performance issues. I just want to position
undefined
How do I *really* justify a horizontal menu in HTML+CSS? You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution: # THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE # # ^ ^ # There's an varying number of text-only menu items and the page layout is fluid. The first menu item should be left-aligned, the last menu item should be right-aligned. The remaining items
undefined
Horizontally center a div in a div How can I horizontally center a div within a div using CSS (if it's even possible)? The outer div has width:100%: <div id="outer" style="width:100%"> <div id="inner">Foo foo</div> </div> Answer : You can apply this CSS to the inner div: #inner { width: 50%; margin: 0 auto; } Of course, you don't have to set the width to 50%. Any width less than the containing div will work. The margin: 0 auto is what does the actual centering. If you are targeting IE8+, it might be
undefined
How to vertically center text with CSS? I have a div tag which contains text, and I want to align the contents of this div vertically center. Here is my div style: #box { height: 90px; width: 270px; background: #000; font-size: 48px; font-style: oblique; color: #FFF; text-align: center; margin-top: 20px; margin-left: 5px; } <div Id="box"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div> What is the best way to do this? answer : You can try this basic approach: div { height: