Ask Your Question

Feature request: Add classes to body in default skin

asked 2010-05-01 01:42:08 -0600

Pekka's avatar

updated 2011-06-12 23:50:26 -0600

Evgeny's avatar

If the <body> tag of each page had a class that corresponds with its URI:

<body class="questions">
<body class="tags">
<body class="people">
<body class="badges">
<body class="ask">

it would become very easy to apply specific CSS styles to specific pages:

body.tags div.AList { ..... }  /* Rule applies to tags page only */
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2010-05-06 13:29:51 -0600

Evgeny's avatar

updated 2011-06-13 11:58:31 -0600

Done a while ago, a page name is added to the class at most pages (but not all yet - only those that required that for the styling).

For example, main page has class "main-page", also multiple classes are used everywhere, at the expense of not supporting IE6, which is almost extinct by now.

Also, added a document on skin customization:

edit flag offensive delete link more


Thanks Evgeny. The great thing about adding classes to the body is that you can target common elements *on a specific page*. I.e. you can say "I want the Ask A Question button to be big and red on the front page, but not on the other pages". At the moment, you would have to touch the HTML for that.
Pekka's avatar Pekka  ( 2010-05-06 15:28:27 -0600 )edit
As for marking up and freezing important elements, that is certainly a great idea. I'm all for it, if I can be of any assistance let me know.
Pekka's avatar Pekka  ( 2010-05-06 15:29:05 -0600 )edit
When my custom skin is ready to look at, I'll be happy to push it to the Git repo into a new directory if that's ok.
Pekka's avatar Pekka  ( 2010-05-06 15:30:17 -0600 )edit
Allright, let's do it if it helps and yes please do commit you r customization it it's ok with you.
Evgeny's avatar Evgeny  ( 2010-05-06 19:22:02 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-05-01 01:42:08 -0600

Seen: 1,058 times

Last updated: Jun 13 '11