Staredit Network > Forums > Technology & Computers > Topic: Overriding DIV's In CSS
Overriding DIV's In CSS
Dec 17 2008, 6:14 pm
By: KilaByte  

Dec 17 2008, 6:14 pm KilaByte Post #1



Okay I have a style sheet that looks like this:

Quote
#container {
font-family: sans-serif;
width: 750px;
height: 902px;
margin: auto;
background-color: #D3D3D3;
}

#header {
width: 750px;
height: 50px;
}
#lsidebar {
width: 150px;
height: 850px;
border-width: 1px;
border-style: solid;
border-color: #4682B4;
background-color: #4682B4;
float: left;
}

#rsidebar {
width: 150px;
height: 850px;
border-width: 1px;
border-style: solid;
border-color: #4682B4;
background-color: #4682B4;
float: right;


}

#main {
width: 450px;
height: 800px;
margin-right: auto;
margin-left: auto;
padding: 0;
}

#footer {
width: 750px;
height: 60px;
background-color: #4682B4;
}

This is for a project that is due later today. The problem is, there is also a mandatory style sheet that looks like this.

Quote

body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #000;
margin: 0;
padding: 0;
text-align: center;
color: #096;
}
#container {
width: 760px;
background: #000;
margin: 0 auto;
border: 5px solid #aaa;
text-align: left;
}
#header {
background: #000;
padding: 0 10px 0 20px;
}
#header h1 {
margin: 0;
padding: 10px 0;
color: #0C0;
}
#lsidebar {
background: #000;
padding: 15px 10px 15px 20px;
}

#lsidebar h1, #lsidebar h2, #lsidebar h3 {
color:#0C0;

}

#rsidebar {
background: #000;
padding: 15px 20px 15px 10px;
}

#rsidebar h1, #rsidebar h2, #rsidebar h3 {
color:#0C0;
}

#main {
padding: 0 20px;
}

#footer {
padding: 0 10px 0 20px;
background:#000;
}

#footer p {
margin: 20px;
padding: 10px 30px;

}
#main h1, #main h2, #main h3 {
color: #0C0;
}
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #000;
margin: 0;
padding: 0;
text-align: center;
color: #096;
}
#container {
width: 760px;
background: #000;
margin: 0 auto;
border: 5px solid #aaa;
text-align: left;
}
#header {
background: #000;
padding: 0 10px 0 20px;
}
#header h1 {
margin: 0;
padding: 10px 0;
color: #0C0;
}
#lsidebar {
background: #000;
padding: 15px 10px 15px 20px;
}

#lsidebar h1, #lsidebar h2, #lsidebar h3 {
color:#0C0;

}

#rsidebar {
background: #000;
padding: 15px 20px 15px 10px;
}

#rsidebar h1, #rsidebar h2, #rsidebar h3 {
color:#0C0;
}

#main {
padding: 0 20px;
}

#footer {
padding: 0 10px 0 20px;
background:#000;
}

#footer p {
margin: 20px;
padding: 10px 30px;

}
#main h1, #main h2, #main h3 {
color: #0C0;
}

Now what can I do to override the CSS in the second sheet with my CSS (The first one).

I can't do the following: (not allowed)
-Change the mandatory.css style sheet.
-Change the name of the DIV ID's
-Put my stylesheet at the top of the pages with the mandatory style sheet below it (Mandatory style sheet has to be the first linked style sheet on each page.)

Any help would be great.



None.

Dec 17 2008, 10:29 pm Doodle77 Post #2



use !important, for example:

width: 150px !important;

It doesn't work in IE6, though.



None.

Dec 21 2008, 3:50 am Syphon Post #3



Put the link to the mandatory in comments? :P



None.

Dec 21 2008, 11:10 pm Forsaken Archer Post #4



Quote
-Put my stylesheet at the top of the pages with the mandatory style sheet below it (Mandatory style sheet has to be the first linked style sheet on each page.)
Win. I know it's late, but I didn't think of this.
I do believe when multiple same decorations are used, the last one is the one that is used. Though the fact this rule is worded opposite makes me doubt myself. I did use this fact when writing a skin for ogame though. I'm not sure what order things where called in.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:13 pm]
Oh_Man -- No APM in chess. Computer just outthinks the human by seeing more moves ahead and more permutations
[10:12 pm]
Oh_Man -- U reckon? Kasparov waa defeated by computer decades ago
[05:47 pm]
NimoStar -- If its any consolation, the human brain would still mop the floor with this bot if it wasn't limited by the mechanical interface
[05:34 pm]
NimoStar -- Well. The bot didn't come up with any new strategy. It just has superhuman micro. Hard to beat that. I reckon even the simplest dedicated chess engines are unbeatable for humans now.
[02:13 pm]
Oh_Man -- all g
[10:54 am]
NudeRaider -- Oh_Man
Oh_Man shouted: NudeRaider did u watch the entire video? it's not one game. it's currently dominating the ladder at number 1 position. do ur research first!
Oops, caught me there, no I haven't. :( I was imagining how the game went. Sorry for that. Watching it now. brb
[10:52 am]
NudeRaider -- NimoStar
NimoStar shouted: They were not "Unprepared" that was their fifth loss in a row against the bot. The other replays are also available
that doesn't mean he was prepared. When humans come around with new strategies it often takes weeks until the pros figure out how to shut it down. Oh_Man that's certainly a way more convincing argument for micro being "too good to beat".
[09:43 am]
DiearAnother -- wirefram
[08:35 am]
NimoStar -- Well, pros showed that long ago... half of zerg pros just ling muta rush
[08:35 am]
NimoStar -- " its shown is that you can trade 1000's of apm to make up for lack of strategy"
Please log in to shout.


Members Online: O)FaRTy1billion[MM], Oh_Man