XHTML/ CSS - ID's

Once again, there is another way to style elements on a webpage. Using the <div> tags we may want to position/ style multiple elements. But how do we do that using one tag. It would seem to move all the elements within the div tag. ID's help us do this without confusion.

<style>

#myHeader {
    background-color: lightblue;
    color: black;
    padding: 40px;
    text-align: center:

 }










#Paragraph {

 background-color: lightblue;
    color: black;
    padding: 40px;

}
 .city {
    background-color: tomato;
    color: white;
    padding: 10px;
}
</style>

<!-- A unique element -->
<h1 id="myHeader">My Cities</h1>

<!-- Multiple similar elements -->
<h2 id="paragraph">London</h2>
<p>London is the capital of England.</p>

<h2 class="city">Paris</h2>
<p>Paris is the capital of France.</p>

<h2 class="city">Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>

If you have more than one <div> element you can create multiple hashtag ID properties in order to style them individually. 

https://www.youtube.com/watch?v=veKHw125UJs&index=23&list=PLC1322B5A0180C946

Comments

Popular posts from this blog

Pyhton 3.4 - Continue

Conversations Ongoing: Valuing Modernization in Early European History

Conversations Ongoing: A Bunch of Amateurs