HighDots Forums  

basic question about CSS

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss basic question about CSS in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
soni2926@yahoo.com
 
Posts: n/a

Default basic question about CSS - 10-24-2008 , 12:08 PM






hi,
what's the difference between using . or #?

#switcher {
....
}

..chapter {
.....
}

is it preference, or the refer to different things?

Reply With Quote
  #2  
Old   
dorayme
 
Posts: n/a

Default Re: basic question about CSS - 10-24-2008 , 05:05 PM






In article <87skqmx8rz.fsf (AT) bsb (DOT) me.uk>,
Ben Bacarisse <ben.usenet (AT) bsb (DOT) me.uk> wrote:

Quote:
soni2926 (AT) yahoo (DOT) com writes:

hi,
what's the difference between using . or #?

#switcher {
...
}

.chapter {
.....
}

is it preference, or the refer to different things?

They are selectors that match element using quite different criteria.
The first matches an element with id "switcher" (there can be only one
per document). The second matches any element that has "chapter" in
its class attribute.

I don't mean to be rude, but this is a rather basic question and
learning CSS by asking in a Usenet group is not likely to be very
productive. You need a good book or tutorial. If you get on well
with formal documents you can read it from the horse's mouth:

http://www.w3.org/TR/2007/CR-CSS21-20070719/ and specifically
http://www.w3.org/TR/2007/CR-CSS21-20070719/selector.html
And if you don't, try

<http://www.htmldog.com/guides/htmlbeginner/>

--
dorayme


Reply With Quote
  #3  
Old   
liketofindoutwhy
 
Posts: n/a

Default Re: basic question about CSS - 10-24-2008 , 09:47 PM



and 2 of the good books i read about CSS are:

CSS Mastery by Andy Budd
and CSS the Missing Manual

HTMLDog seems quite good. i didn't understand why it suggested using
border: 0... i thought it would be better if it is border: none.
margin: 0 is a better example of use 0 without any unit.


Reply With Quote
  #4  
Old   
dorayme
 
Posts: n/a

Default Re: basic question about CSS - 10-24-2008 , 10:04 PM



In article
<1d754bb8-d571-4b01-aec9-f3f6d56ad777 (AT) v22g2000pro (DOT) googlegroups.com>,
liketofindoutwhy <liketofindoutwhy (AT) gmail (DOT) com> wrote:

Quote:
HTMLDog seems quite good. i didn't understand why it suggested using
border: 0... i thought it would be better if it is border: none.
border: 0; is better because it is shorter. Surely that is sufficient
reason?

Perhaps a bigger mystery is why it uses XHTML instead of HTML. Perhaps
because people will think it old hat otherwise? <g>

--
dorayme


Reply With Quote
  #5  
Old   
Johannes Koch
 
Posts: n/a

Default Re: basic question about CSS - 10-25-2008 , 05:19 AM



liketofindoutwhy schrieb:

Quote:
HTMLDog seems quite good. i didn't understand why it suggested using
border: 0... i thought it would be better if it is border: none.
'border: 0' sets another property (border-width) than 'border: none'
(border-type). Both are covered by the 'border' shorthand.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)


Reply With Quote
  #6  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: basic question about CSS - 10-25-2008 , 10:06 AM



Johannes Koch wrote:
Quote:
liketofindoutwhy schrieb:

HTMLDog seems quite good. i didn't understand why it suggested using
border: 0... i thought it would be better if it is border: none.

'border: 0' sets another property (border-width) than 'border: none'
(border-type). Both are covered by the 'border' shorthand.
Actually, they set exactly the same _properties_, though to different
_values_.

border: 0 by definition sets
border-width to 0
border-style to none
border-color to content color of the element

border: none by definition sets
border-width to medium
border-style to none
border-color to content color of the element

Thus, they are _not_ equivalent, even though they _often_ have the same
effect. Of course, they both imply just that no border appears _if_ no other
style sheet is applied. However, if no other style sheet is applied,
border-style is none anyway, as that's the initial value as defined in CSS
specifications!

If you later set, for example, border-style: solid for the element, then no
border appears if you had first set border: 0 (since border width is still
zero). But if you had first set border: none, then you will see a solid
border of width medium (typically 4 pixels) with the element's content
color.

Rules for using "shorthand notations" (like border and font) in CSS:

1. If you don't really understand them, don't use them.

2. If you really understand them, you don't need my advice to stay away from
them. :-)

--
Yucca, http://www.cs.tut.fi/~jkorpela/



Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.