• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest Add a CLASS to the body

Rigel Kentaurus

Well-known member
#1
I have been editing PAGE_CONTAINER just to add
<body class="myStyle">

That is because I then can do really fine grained CSS definitions, and make sure those are only included for a specific style.

Having the ability to set a class on the body tag would certainly be useful.
 

Mike

XenForo developer
Staff member
#3
Wouldn't defining that CSS as part of the style... only apply the rules to that style? I'm not following the example.
 

Rigel Kentaurus

Well-known member
#5
I am planning to include a single stylesheet in the page (same css file, even if different styles)

I am aware that is probably not good for the page (bunch of styles not used), but maintenance wise it is easier to have just one master stylesheet with several definitions that will kick in when a certain style is active.

I use it on certain sites like that ... then I only change the body class and the page looks completely different.
 
#6
The main usefulness I have found for adding a class or id to the body (id is really the way to go here, due to specificity) is the ability to add to the main stylesheet code like "body#this_one h1" etc. Depending on the amount of special css you are applying to a page it can be more efficient than adding another stylesheet call.