Can you make entire contents of DIV a class?

FrontPage97

New Member
Let's say you have a repeating element like a footer with tons of text links at the end of every page. If I add a page to the site then I don't want to have to edit the footers on every single page. Would that be done with a compound class???
 
Last edited:

Phreaddee

Super Moderator
Staff member
:before and :after pseudo classes can add "content" but I wouldn't recommend it. Sorry not really understanding your question...
You can style all footer links simply by targeting footer a, or #footer a depending on how you've done your footer.
 

FrontPage97

New Member
I see that "content" is a property option. The values to choose from are
attr(x)
close-quote
counter(name)
[a few more counter related values]
icon
inherit
no-close-quote
no-open-quote
normal
open-quote
I see a lot of tutorials about changing link color. None about styling hyperlink URLs.
 

Phreaddee

Super Moderator
Staff member
before and after content gives you content as in

a:before {
content: "add some text here";
}


like I said it's not a recommended option. you know the whole separation of markup and content blah blah...

what sort of "styling" do you want to do to the links?


footer a {
/* add your styles here */
}
 

chrishirst

Well-Known Member
Staff member
Using CSS. Can you include text as part of a class?

Right!
So rather than 'compound class' you probably mean using pseudo elements

I think the best answer to that is, 'possibly' and be aware that 'non-visual' user agents will not render the :before and :after pseudo classes, so they should only be used to insert content, elements or information that is inconsequential to the document as a whole.

Server-side includes are what you should use for putting 'boiler plate' content into a document.
 

leroy30

New Member
Yeah, that is a far better option. CSS content isn't supported by all browsers yet plus it's a messy way to do it that's for sure.

Server-side pre-compiling of your pages (i.e. 'includes' if you're using PHP) is the best way to go. It allows you to have templated elements that you can use wherever you see fit.

The ASP.net version of this is master pages and user controls.
 

chrishirst

Well-Known Member
Staff member
The ASP.net version of this is master pages and user controls.

Not strictly true, .NET 'master' pages are more akin to 'FrontPage Extensions' than SSI.

It can be a real PITA to override 'master' pages on a given condition (as it was with FPE), but with SSI (php or asp), a simple
Code:
if ... then ... else... end if
construct can be used to decide whether a section should be used or not.
 
Top