Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Two Styles, practicaly identical: can I avoid repitition?
Old 04-12-2007, 06:39 AM Two Styles, practicaly identical: can I avoid repitition?
Ultra Talker

Posts: 316
Trades: 0
I have two DIVs, each with their own style.
They are pretty much identical except for one two lines.
Is there a way to combine the styles that are the same into one style and then seperate the styles I want to be different into seperates styles?

Code:
body {
    margin: 0px;
    padding: 0px;
    height:100%;
}
#header {
    border-width: 0px 0px 1px 0px;
    border-style: solid;
    border-color: #7F7F7F;
    width: 100%;
    padding: 5px;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 12px;
    font-weight: normal;
    text-align: right;
    color: #7F7F7F;
    position:absolute;
    right:0px;
    top:0px;
    background-color: #FFFFFF;  
}
#footer {
    border-width: 1px 0px 0px 0px;
    border-style: solid;
    border-color: #7F7F7F;
    width: 100%;
    padding: 5px;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 12px;
    font-weight: normal;
    text-align: right;
    color: #7F7F7F;
    position:absolute;
    right:0px;
    bottom:0px;
    background-color: #FFFFFF;  
}
The bold lines are the only ones that are different.

If I could combine all the other properties it would save me changing them twice.

Thanks.
Joe3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-12-2007, 10:29 AM Re: Two Styles, practicaly identical: can I avoid repitition?
King Spam Talker

Posts: 1,186
Location: Manchester, UK
Trades: 0
Specify common properties in the first rule and then specify the div specific properties in the following rules:

HTML Code:
#header, #footer {
    border-style: solid;
    border-color: #7F7F7F;
    width: 100%;
    padding: 5px;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 12px;
    font-weight: normal;
    text-align: right;
    color: #7F7F7F;
    position:absolute;
    right:0px;
    background-color: #FFFFFF; 
}

#header {
    border-width: 0px 0px 1px 0px;
    top:0px;
}
#footer {
    border-width: 1px 0px 0px 0px;
    bottom:0px;
}
gringo is offline
Reply With Quote
View Public Profile Visit gringo's homepage!
 
Old 04-12-2007, 11:31 AM Re: Two Styles, practicaly identical: can I avoid repitition?
Ultra Talker

Posts: 316
Trades: 0
Thanks for that.

I had completely forgotten about combining them like that!
Joe3000 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Two Styles, practicaly identical: can I avoid repitition?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18470 seconds with 12 queries