Forum Moderators: not2easy
Do you know if there's a way of resetting the style on a part of a web page? More specific: I have a page with a linked in style sheet like so:
<LINK href="../Styles/Standard.css" type="text/css" rel="stylesheet">
On one part of the page, I don't want the content to be formatted with this style at all (the reason for this is that I have a rich text editor embedded which is currently being affected by the style).
Any help would be highly appreciated!
Maybe a declaration like this: <span class="nostyle">
.nostyle {
position:relative; top: 0px; left: 0px;
background-color: #000000;
color: #000000;
or whatever, etc.,
}
will that validate? I've had a few issues with span tags and validation lately
It will validate as long as there are no block level elements nested inside the span. Since <span> is an inline element, specs say it cannot contain any block level elements, so this...
<p><span>foo</span>bar</p>
..validates while this...
<span><p>foo</p>bar</span>
...and this...
<p>foo<span>bar</p></span>
...do not, the first because it nests a paragraph (block level) inside a span (inline), the second because it improperly nests the span.
Inline-level elements are those elements of the source document that do not form new blocks of content; ... (e.g., ... inline images, etc.).
It turns out I wasn't 100% correct in my last post. For one thing, CSS2.1 specs don't explicitly say that inline boxes can't contain block boxes. What it does say is that when it happens, the block box splits the inline box in half.
I played around with this in the validator, using an HTML 4.01 STRICT doctype, with one line where a <p> contained a <span> and one where a <span> contained a <p>. Obviously, the first one passed fine.
The second came back with two errors...one was that a <p> element is not allowed inside a <span>. I think it might actually be HTML specs that don't allow this, not CSS. The other was that the <span> tag was not allowed in it's context either...in other words, that a <span> tag is not allowed to be outside of a block box..or to put it another way, inline elements must be contained by block level elements.
That said, and getting back to your question about <img> and <span>, you're talking about two inline elements. If you've got an image in a span, but the span itself is not inside a block box, that's probably the validator's problem.
Any help? Reading W3 specs sometimes feels like watching the movie "My Big Fat Greek Wedding" then trying to read Homer in the original Greek...
Oh well. Just meant I had to do it all with div tags instead....
Oh, just validate each CSS independently ;)
i use 3 CSS files for each page. 1 formats text, 1 formats layouts, and another formats links.
goodluck chap