Is it wrong to change a block element to inline with CSS if it contains another block element?

From the CSS 2.1 Spec: When an inline box contains an in-flow block-level box, the inline box (and its inline ancestors within the same line box) are broken around the block-level box (and any block-level siblings that are consecutive or separated only by collapsible whitespace and/or out-of-flow elements), splitting the inline box into two boxes … Read more

What’s the difference between and , and ?

They have the same effect on normal web browser rendering engines, but there is a fundamental difference between them. As the author writes in a discussion list post: Think of three different situations: web browsers blind people mobile phones “Bold” is a style – when you say “bold a word”, people basically know that it … Read more

Can we have multiple in same ?

Yes you can use them, for example I use them to more easily style groups of data, like this: thead th { width: 100px; border-bottom: solid 1px #ddd; font-weight: bold; } tbody:nth-child(odd) { background: #f5f5f5; border: solid 1px #ddd; } tbody:nth-child(even) { background: #e5e5e5; border: solid 1px #ddd; } <table> <thead> <tr><th>Customer</th><th>Order</th><th>Month</th></tr> </thead> <tbody> <tr><td>Customer … Read more

What are all the valid self-closing elements in XHTML (as implemented by the major browsers)?

Every browser that supports XHTML (Firefox, Opera, Safari, IE9) supports self-closing syntax on every element. <div/>, <script/>, <br></br> all should work just fine. If they don’t, then you have HTML with inappropriately added XHTML DOCTYPE. DOCTYPE does not change how document is interpreted. Only MIME type does. W3C decision about ignoring DOCTYPE: The HTML WG … Read more

How do I link to part of a page? (hash?)

If there is any tag with an id (e.g., <div id=”foo”>), then you can simply append #foo to the URL. Otherwise, you can’t arbitrarily link to portions of a page. Here’s a complete example: <a href=”http://example.com/page.html#foo”>Jump to #foo on page.html</a> Linking content on the same page example: <a href=”#foo”>Jump to #foo on same page</a> It … Read more