₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,605 members, 8,512,708 topics. Date: Tuesday, 03 November 2026 at 08:14 PM

Toggle theme

Css Test 3 - Webmasters - Nairaland

Nairaland Forum › Science/Technology › Webmasters › Css Test 3 (846 Views)

1 Reply

Css Test 3 by yawatide(op): 10:05am On Jul 12, 2009
These are getting quite interesting  grin

Another (some code purposely stripped off in the interest of brevity as it has nothing to do with the actual quiz itself wink):

Building on quizzes 1 and 2 (https://www.nairaland.com/nigeria/topic-293811.0.html and https://www.nairaland.com/nigeria/topic-294974.0.html), let's say you have a site with 10 pages and all, thanks to the power of includes, have this code snippet in them:

<style>
div.blah { margin-top: 10px; }
</style>

<div class="blah">blah blah</div>
Now, let's say that 1 or 2 of those pages needs to have a unique top margin.  I could do it in one of 2 ways:
<div class="blah nairaland">blah blah</div> OR <div id="nairaland" class="blah">blah blah</div>
I personally would go for #2 as I don't like "classitis" but for the sake of argument, let's just say I wasn't aware of this "disease" and decided to go for #2 anyways, with the following rule:
<style>
div#nairaland { margin-top: 20px; }
</style>
Questions:
1) Given <div class="blah" id="nairaland">blah blah</div>, which rule (ID or CLASS) gets applied to the particular page
2) why?
3) Which of these is valid syntax?
3a) <div class="blah" class="nairaland">blah blah</div>
3b) <div class="blah nairaland">blah blah</div> OR
3c) <div id="blah nairaland">blah blah</div>
4) Explain your answer to #3 above


As always, I await your answers.
Re: Css Test 3 by Nmeri17: 5:47pm On Nov 25, 2014
hmmm ques 1 ---> ID
QUES 2. I think it's because there's only one value
someone should comman answer 3 abeg embarassed
Re: Css Test 3 by Nobody: 9:39pm On Nov 25, 2014
So whats the need of adding class in your DIV?
1 Reply

Write HTML And CSS Codes On Android Devices • How To: Create A Simple Hover Button With Html And Css • How Is My **Free** Css Ebook? • 2 • 3 • 4

Website Traffic Generation Made So Easy • Compare These Three Websites:nairaland,lagbook & Nahere • Website Review