Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 8th, 2013, 3:56 PM   #1
tcw7
Newbie
 
Join Date: Dec 2012
Posts: 11
Rep Power: 0 tcw7 is on a distinguished road
Using # or "." ?

Hi all,

I am using WordPress to build a site...and

I see some CSS code in the style.css file.

Some of it begins with a # or .
before the command.

FOR EXAMPLE
#header {
padding: 0;
margin: 0 0 0 -20px;
background: #fff;
width: 980px;
}

NOW...can someone use this as well?

.header {
padding: 0;
margin: 0 0 0 -20px;
background: #fff;
width: 980px;
}


NOW...can someone use this as well?
Will the effect be the same?

thanks for your help!
tcw7 is offline   Reply With Quote
Old Jan 8th, 2013, 5:54 PM   #2
pritaeas
mod_pritaeas
 
Join Date: May 2009
Location: The Netherlands
Posts: 251
Rep Power: 8 pritaeas is on a distinguished road
Re: Using # or "." ?

The dash (#) is used for id's while the dot (.) is used for classes. Example:
#header { width: 100px; height: 100px; border: 1px solid #000; color: #00f }
.header { color: #f00; font-weight: bold }

<div id="header">
  <span class="header">Text with</span> and without the header class.
</div>
pritaeas is offline   Reply With Quote
Old Jan 9th, 2013, 7:22 PM   #3
tcw7
Newbie
 
Join Date: Dec 2012
Posts: 11
Rep Power: 0 tcw7 is on a distinguished road
Re: Using # or "." ?

Thank you Pritaes!
tcw7 is offline   Reply With Quote
Old Jan 22nd, 2013, 7:13 PM   #4
apollo
Newbie
 
apollo's Avatar
 
Join Date: Jan 2013
Location: Birmingham, Alabama
Posts: 3
Rep Power: 0 apollo is on a distinguished road
Talking Re: Using # or "." ?

To go further, ID's (#) are #unique, and thus are only suppose to appear once on your site. On the other hand, .classes can appear multiple times and are used for common elements among multiple pages.
apollo is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"." operater? Kilo Assembly 4 Jun 11th, 2006 12:23 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC