Reputation: 28294
I have two css files:
A main file (main.css)
A specific page file (page5.css). My page.css contains main.css (@import url(main.css));)
My main.css has this as one part of it that sets the height of the page
#content {
background:url(../images/image.png) no-repeat;
width:154px;
height:356px;
clear:both;
}
This works fine for all the other pages, but at page 5, I need a little bit more height.
How would I go about doing it?
Upvotes: 11
Views: 87766
Reputation: 418
You can do it using 'id'.
HTML
<a id="contact" href = "mailto: [email protected]">Contact us.</a>
CSS
#contact{
text-decoration: none !important;
font-size: x-large;
}
Upvotes: 0
Reputation: 2688
The other answers did not help me on a more complex page.
Let's suppose you want something different on page X.
This works for me.
Upvotes: 0
Reputation: 50185
You don't even need a separate CSS file necessarily. You can add classes to your body for various purposes, identifying page or page type being one of them. So if you had:
<body class="page5">
Then in your CSS you could apply:
.page5 #content {
height: XXXpx;
}
And it would only apply to that page as long as it occurs after your main #content
definition.
Upvotes: 28
Reputation: 29160
In page5.css
, simply re-define the height.
page5.css
#content {
height:400px;
}
Upvotes: 1
Reputation: 449505
Just re-define it somewhere after your @import
directive:
#content { height: 456px }
for identical CSS selectors, the latter rule overwrites the former.
Upvotes: 2