PDA

View Full Version : Can CSS affect only a segment of a webpage?


tired&lonely
09-08-2002, 02:22 PM
Is there a way to have a style sheet take effect only over segment of a webpage... say, from the top of a webpage down to the middle of the webpage?... or, from the middle of a webpage down to the bottom?

Mr J
09-08-2002, 02:59 PM
In order to have what you require would mean placing the content that you want rendering with CSS in DIV tag container with the appropriate ClassName.

realisis
09-08-2002, 04:52 PM
a couple of strategies I've considered in the past, but haven't tried out yet:

I guess you could wrap (for example) the bottom half of the page in a DIV, and use local style declarations within the DIV tag... this would be inherited by the children, but you would be limited to simple declarator:value attribute pairs, and you couldn't target separate tags this way.

You could also just put an inline STYLE sheet right in the middle of the page, and (I think) it would affect everything thereafter... I've seen this done on some MS pages, but I'm not sure whether it's valid HTML (if that matters to you), or what the side-effects might be.

There's also the old <plaintext> tag, which apparently nullifies any formatting from the point of its appearance to the end of the page - haven't tried it though.

...

If you're targetting Netscape4, that browser allowed setting styles via javascript dot-syntax. You can declare separate styles any number of times on the page, but the statements must be declared at layout, and can't be modified thereafter. FYI...