XHTML/ CSS - Styling Using Classes
Once again there is another way to style elements. We can create a class for an element and apply that class to other elements equally. Here's an example:
<style>
.city {
background-color: tomato;
color: white;
padding: 10px;} </style>
<h2 class="city">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>
In this example, the class created is city. We have given it some properties and we've added the class to the elements we wanted to.
https://www.youtube.com/watch?v=veKHw125UJs&index=23&list=PLC1322B5A0180C946
<style>
.city {
background-color: tomato;
color: white;
padding: 10px;} </style>
<h2 class="city">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>
In this example, the class created is city. We have given it some properties and we've added the class to the elements we wanted to.
https://www.youtube.com/watch?v=veKHw125UJs&index=23&list=PLC1322B5A0180C946
Comments