Step 22: CSS ID and CLASS rules

Lets say you want to make a box on the right of your page where you can insert text...then you would need to make your own tag and define it via CSS in order for it to do so....

We use ID and CLASS selectors to get the job done for us...

We use them like this :

HTML file

This content goes into the box on the right hand side of the page </p>

CSS file

border: 2px solid black;

To style div id's that you make, you <span style= “background-color: #FFFF00″>use the "#" sign</span> in the CSS file...
To style div classes that you make, you <span style= “background-color: #FFFF00″>use a "." (period)</span> in the CSS file

IDs are used when you are making it like a whole different tag like in the example above, but CLASSES are used when you want to style things inside another tag, like


<p> This <div class="MYFIRSTDIVCLASS"> text </div> is styled by div class...</p>

CSS file


So classes are used when you have the specific div class inside another HTML tag (Excluding HTML, Body and Head tags)
Pre-defined elements like (h2, p, h1, br, em, i, b etc...) are edited using the div class function because they are repeated a lot of times in the document, and therefore it has to be a class div...
Div IDs are used when you are going to use the styles element only once in the HTML document...

<p>I love your blog, guys, but I&rsquo;m very disappointed, that you don&rsquo;t take a look at the web designers in Australia (or I just don&rsquo;t saw it?). Anyway, I wanna recommend you an online blog of a very talented lady from Brisbane. This web page is a naturally essence of design in Australia http://www.olyablack.com/. I think, that jobs of this girl are awesome. I love this drawing style so much, it&rsquo;s very creative. And another interesting fact: Olya was born in Russia. It&rsquo;s amazing, I think, that Russian designers will be a new avant-garde of webdesign.</p>
<p>thats good job</p><p>http://www.ticworks.com/services/online_solutions/website_development.html</p>
Thank you! I enjoyed your tutorial
<p>This is fantastic.</p><p>I can now work well with HTML in designing my web page. Thanks so much</p>
<p>A well done job Vishal! It will more helpful for beginners to enhance their knowledge.</p>
<p>Looks this is a wonderfully architectured site well designed. Only unique &lt;a href=&quot;http://seosaisantosh.com/web-designing-company-in-hyderabad/&quot;&gt;web designing company in hyderabad&lt;/a&gt; can design similar sites or sites with a genuine layout that no othe companies can design.</p>
<p>This is the great article very helpful tutorial for designers keep sharing.</p><p><a href="http://goo.gl/cIX7It" rel="nofollow">http://goo.gl/cIX7It</a></p>
<p>Excellent article!</p><p> Its very helpful to understand the webpage. We are the leading website designing services providers in allover the world and also we give complete solution for all types of websites.</p><p>Thnx</p>
<p>Thanks for sharing very helpful tutorial. I want to suggest <em><a href="http://www.developmenticon.com/" rel="nofollow">Developmenticon</a></em> (<a href="http://www.developmenticon.com" rel="nofollow">www.developmenticon.com</a>) for the best Drupal development services. They convert your PSD file into responsive drupal website.</p>
<p>Great article !</p><p>We are experts in Website Design &amp; Development (PSD to HTML5, Wordpress, PHP), Software Development, Mobile App Development and more.</p><p>Visit us: <a href="http://imperialservices.co.in/" rel="nofollow">http://imperialservices.co.in/</a></p>
<p>Well it is good for you that you learning HTML &amp; CSS. Keep learning about <a href="http://dubaimonsters.com/services/web-design-dubai/" rel="nofollow">web design dubai</a> services how they work on web designing. </p>
Awesome tutorial!<br>Just made a little page for my birthday to provide qr codes. <br>We re doing a rally. <br>Maybe I will upload an instructable. Using pi web server; qr codes and my new hot page!<br>Thanks!
<p>You can check out my tutorial, it is simply the basics. I'll create an even deeper one later!</p>
<p>I can web design and code very well.. my weak point is only CSS sometimes I don't understand it.. Any tutorial for help would you suggest?</p><p><a href="http://www.webdesignerdubaicompany.ae/" rel="nofollow">Web Design Dubai Company</a></p>
<p>Cool visual tutorials. Help me a lot in my academic web designing projects.</p><p><a href="http://www.gulfwebdesigncompany.com/" rel="nofollow">Dubai Web Design Company</a></p>
<p>Well defined basic web design tutorial. What is the first step to take in web design please tell me?</p><p><a href="http://www.dubaiwebdesignagency.com/" rel="nofollow">UAE Web Design</a></p>
<p>How about an advanced web design where do I get tutorials from? Any help would be appreciated</p><p><a href="http://www.adwebstudiodubai.com/" rel="nofollow">Web Design Dubai Company Adwebstudio</a></p>
<p>In this post, very informative knowledge has been shared by vishalapr. Here, I want to suggest HTMLPanda (<a href="http://www.htmlpanda.com/" rel="nofollow">www.htmlpanda.com</a>) for the best web and mobile app development services. They convert your PSD file into 100% hand coded HTML or HTML5 and CSS.</p>
<p>Great post if you want can found more on devox.io</p>
<p>Great post thanks for sharing </p>
<p>OMG thank you,i've been such a n00b at thisXD </p>
<p>Very Useful guidelines for Beginners. Thx </p>
<p>Nice guidelines indeed, also I see you where interested in certificates so I would like to recommend you to check this out:</p><p>http://www.testdome.com/Certificates</p><p>These are free certificates for which you need to solve some online coding tests, something like these ones (which you can use for practice):</p><p>http://www.testdome.com/Programming-Tests/Html-Css/13</p>
<p>Nice post for learning web designing!! Get web design and web <br>development services at <a href="http://inoday.com" rel="nofollow">inoday</a></p>
<p>I am currently taking a class and trying to figure out how to do the HTML formatting, and I am very, very confused with the formatting of the text. Any help as far as websites or information would be greatly appreciated. </p>
<p>forgot the doctype...</p>
<p>upgrade to html5! Nice though.</p>
I have two questions<br/>1.Did you use notepad? <br/>2.How did you view your text on a page without the code?<br/>I'm new to HTML and CSS<br/>Thank you for everything!
<p>Yes I used notepad and I took a screen shot of the text in the web browser and cropped out the rest.</p>
<p>Nice these basic steps are useful and helpful for <strong><a href="http://www.mastercomputech.com/" rel="nofollow">website designing</a> </strong></p>
<p>Ensure you use Google Chrome, Safari or Firefox if you would like to find the &quot;Inspect Element&quot; tool, which allows you to highlight specific parts of the HTML and see which part of the website they correspond to.</p>
<p>This was very helpful - clear and effective. Thank you so much for all your time and effort</p>

About This Instructable




Bio: A programming enthusiast. I tinker around with everything I see and love to game.
More by vishalapr:Diffused Glue Stick Lamp ATtiny85 POV Display Artoo [R2] (ATtiny2313 Wall Avoiding Robot) 
Add instructable to: