473,325 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

basic question about CSS

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

#switcher {
....
}

..chapter {
.....
}

is it preference, or the refer to different things?
Oct 24 '08 #1
6 1269
so******@yahoo.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-2.../selector.html

--
Ben.
Oct 24 '08 #2
In article <87************@bsb.me.uk>,
Ben Bacarisse <be********@bsb.me.ukwrote:
so******@yahoo.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-2.../selector.html
And if you don't, try

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

--
dorayme
Oct 24 '08 #3
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.

Oct 25 '08 #4
In article
<1d**********************************@v22g2000pro. googlegroups.com>,
liketofindoutwhy <li**************@gmail.comwrote:
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
Oct 25 '08 #5
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.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Oct 25 '08 #6
Johannes Koch wrote:
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/

Oct 25 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Leif K-Brooks | last post by:
Has anyone ever tried implementing a simple unstructured BASIC dialect in Python? I'm getting interested in language implementation, and looking at a reasonably simple example like that could be...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
54
by: seberino | last post by:
Many people I know ask why Python does slicing the way it does..... Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring gives me elements 0, 1, 2 and 3...
13
by: Pete | last post by:
I'm cross posting from mscom.webservices.general as I have received no answer there: There has been a number of recent posts requesting how to satisfactorily enable BASIC authorization at the...
13
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
6
by: Simon Walsh | last post by:
I'm an Electronics student in college and I'm currently working on a project. I was given a circuit diagram for my project, from which I had to design a printed circuit board to be sent off and...
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
43
by: Bill H | last post by:
25 years ago every computer came with some form of Basic interpreter so you could use yoru computer without having to buy more software. Is Javascript (teamed with HTML) set to become the new...
1
by: steve | last post by:
A series of articles examining some basic concepts in Sql Server. Basic Anatomy of Sql Server, part I What is a stored procedure?...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.