Let's see that how we can use the class inside the css. Its really easy not a rocket science. IN Css we should have to start it in the head and then it will be started with the "." Dot and then we can write the name of the class let's see the example that how it works. For thatView more random threads:
- HTML and CSS working
- basic introduction to HTML 2012
- HTML <img> Tag for html users 2011
- HTML course for Pakistani students
- why html is important for students? do you have any idea?
- Differences Between XHTML And HTML New updates June 2011
- Use Lowercase Tags instead of Uppercsse in html for...
- HTML Web Page Template with Colored Background Options job...
- HTML course for Foreign students free online
- div tag is used in html 2011
it shows that how it works. Now note that the class name should not be start with a number other wise it will not work other web browser then Internet explorer.HTML Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> .center { text-align:center} </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p class="center">Welcome to new class</p> <h1 class="center">Heading is center because of the Class</h1> </body> </html>
Sponsored Links
<b>We also can specify that only specific HTML element like a p for paragraph tag </b>
Lets see an other example which will show that how CSS works with class
It will not show the result as we see in the previous example.HTML Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> p.center { text-align:center} </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Css class</title> </head> <body> <p class="center">Welcome to new class</p> <h1 class="center">Heading is center because of the Class</h1> </body> </html>
There are currently 1 users browsing this thread. (0 members and 1 guests)