homepage Welcome to WebmasterWorld Guest from 54.196.62.23
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
"Resetting" style on part of page
how to reset the style on part of page
gunnar

5+ Year Member



 
Msg#: 4323 posted 6:53 pm on Aug 15, 2004 (gmt 0)

Hi!

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!

 

Rhys

10+ Year Member



 
Msg#: 4323 posted 12:53 am on Aug 16, 2004 (gmt 0)

Surround the part of the page you with to have unaffected with <span> tags and style it different or nostyle. Only the part page within the Span will be affected, and normal styles will resume after the tag.

Maybe a declaration like this: <span class="nostyle">

.nostyle {
position:relative; top: 0px; left: 0px;
background-color: #000000;
color: #000000;
or whatever, etc.,
}

vkaryl

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4323 posted 1:01 am on Aug 16, 2004 (gmt 0)

Rhys: will that validate? I've had a few issues with span tags and validation lately, why I ask...

createErrorMsg

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4323 posted 1:15 am on Aug 16, 2004 (gmt 0)

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.

vkaryl

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4323 posted 1:24 am on Aug 16, 2004 (gmt 0)

cEM: yah, I got that.... problem lieth with trying to span tag an img tag.... is img considered block level?

createErrorMsg

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4323 posted 1:58 am on Aug 16, 2004 (gmt 0)

Inline-level elements are those elements of the source document that do not form new blocks of content; ... (e.g., ... inline images, etc.).

Ellipses and bold are mine. The above is a quote from the 2.1 specs. Whether there is such a thing as a block image, I don't know, but I assume most images are inline, in that they are held inside of block boxes and appear inline with text. I assume this means that the default for images is inline, changeable with display: block, of course.

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...

vkaryl

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4323 posted 2:29 am on Aug 16, 2004 (gmt 0)

Okay. You "validated" my (admittedly suspect, because I'm such a css newbie) experience. I just went back and tried to validate my original stuff and still no go. I'm told I need any one of a whole list of of block type elements first....

Oh well. Just meant I had to do it all with div tags instead....

silk

10+ Year Member



 
Msg#: 4323 posted 9:03 am on Aug 16, 2004 (gmt 0)

You can link more than 1 CSS file to a page, PLUS use an inpage CSS. Define new classes and use them. Override clashes with the!important; command. I have used multiple different styles on my links, all in 1 page using this method.

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved