/    Sign up×
Community /Pin to ProfileBookmark

Strategy for managing various body tags within the same website

Hello!

I’m getting my act together and finally using CSS for all formatting on my website, including the body tag. There are a few pages, though, for which I’d like to NOT have the background image display and have different margins, but everything else from the default.css file (text, tables, etc.) to continue to apply.

What’s the best strategy to format these differentiated pages without having to create a whole new .css file with some repeated tags, but a different body? Or is that the way to do it? I tried editing the body tag directly on one of those pages, but I don’t know how to tell it not to apply the background and have standard margins.

Thanks in advance!!

Me ?

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@dtm32236Aug 17.2007 — If it's just a couple attributes you're changing (ie. margin, background-image, etc...):

If you do <body style="margin:0px; background-image:none">

this overwrites the default attached CSS.

does that make sense?

any css you put in a tag, will overwrite the existing css from your stylesheet.

I hope that answers your question.
Copy linkTweet thisAlerts:
@NatuScapeauthorAug 17.2007 — Yes, thank you! The "background-image:none" worked like a charm!!

I'd like the margin to be the default value so these pages have a bit of margin around them (the rest of the website is set at 0px for top and left), how do I tell it that I want default margins? Or what's the value so I set it to that? I tried "auto", but that didn't do the trick...

Thanks again!

Me ?
Copy linkTweet thisAlerts:
@TJ111Aug 17.2007 — If your making the same changes on multiple changes, your best option is to make a class for the items you want to have different version of. For example if you could have:

<i>
</i>body {
margin:0px;
padding:0px;
width:100%;
background-image:url(bgImg.jpg);
}
body.alternate {
margin:15px;
background:none;
}


Then on the pages you want the different body just change the <body> tag to <body class="alternate">
Copy linkTweet thisAlerts:
@dtm32236Aug 17.2007 — i dont know if this will work, but try

margin:1em 1em 1em 1em;
Copy linkTweet thisAlerts:
@NatuScapeauthorAug 18.2007 — Thank you both!! The 1em worked out and I used the class for the body tags of the pages I wanted to have no background image.

I know there's lots of reasons why I love this website ? ?

Enjoy your weekend!

Me ?
Copy linkTweet thisAlerts:
@dtm32236Aug 19.2007 — glad we were able to help.

take care.
×

Success!

Help @NatuScape spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...