Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Difference between Class and a Element
Old 11-22-2006, 02:34 PM Difference between Class and a Element
lunchbox170's Avatar
Extreme Talker

Posts: 151
Name: Ben
Trades: 0
Ok, I am confused, what is a element. like #element, when should you use a element instead of a class?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
lunchbox170 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-22-2006, 02:54 PM Re: Difference between Class and a Element
Mooofasa's Avatar
Defies a Status

Posts: 1,611
Name: Michael (mik) Land
Location: England
Trades: 0
Each id (e.g. #wrapper) should only be used to define ONE instance of th element in the HTML. Classes (e.g. .wrapper) may be used any number of times to define several instances of tags. You specify the ID or CLASS in the CSS for the file and then use id="wrapper" or class="wrapper" (depending on whether it is # (id) or . (class)) in your opening element tag (e.g. <p class="right"></p>).

Elements are the tags (<p>, <h1>, etc).

IDs and CLASSes are a little more complex than just how to use them. When you get to selector level and dominance (advanced CSS) then it gets more interesting and useful.
__________________

Please login or register to view this content. Registration is FREE
- Tumblog with thoughts, quotes, links, videos, images and my creations.

Please login or register to view this content. Registration is FREE
- The best free web browser.

Please login or register to view this content. Registration is FREE
- Firefox is now Firefail.

Last edited by Mooofasa; 11-22-2006 at 02:55 PM..
Mooofasa is offline
Reply With Quote
View Public Profile Visit Mooofasa's homepage!
 
Old 11-24-2006, 06:04 PM Re: Difference between Class and a Element
frofi's Avatar
Extreme Talker

Posts: 236
Location: London
Trades: 0
These are the basics that should explain it for you:
CSS (your style sheet. Name it mystylesheet.css)
Code:
#element {
position: absolute;
margin: 0px;
background-color: #666;
padding-top: 20px;
width: 100%;
height: 100px;
left: 0px;
top: 200px;
}

.class {
color: #FFF;
text-align: center;
text-decoration: underline;
font-family: "Times New Roman", Times, serif;
font-size: 24px;
}
HTML (this is how you can use it)
Code:
<html>
<head>
<title></title>
<link rel="stylesheet" href="mystylesheet.css" type="text/css"  />
</head>
<body>
<div id="element" class="class">It works like this</div>
</body>
</html>
__________________
THE FORCE is with me at last! All I need now is some TALKUPATION ;)
frofi is offline
Reply With Quote
View Public Profile
 
Old 11-29-2006, 10:35 PM Re: Difference between Class and a Element
kIDJOE's Avatar
Extreme Talker

Posts: 186
Location: Hollywood, CA
Trades: 0
Classes can be called as many times to style any element in your document, #Elements are only to one object in your document. use # for laying down a document, and use clases to style
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

kIDJOE is offline
Reply With Quote
View Public Profile Visit kIDJOE's homepage!
 
Reply     « Reply to Difference between Class and a Element
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26039 seconds with 12 queries