I am making a webpage with HTML4 and was wondering if anyone could answer this question:
What is the use of ID in CSS (#) when you could easily use CLASS (.) ?
Thank you!
Last edited by KrIsMa (2013-03-25 17:42:56)
Offline
An ID is used for something that is unique and it's used mainly with Javascript for selecting the content or modifying an object.
Offline
veggieman001 wrote:
An ID is used for something that is unique and it's used mainly with Javascript for selecting the content or modifying an object.
but can't you use an open selection like .warning {css blah}?
Offline
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/
cause i like deprecated attributes cause i am style free XD
plus, i have a image free browser.
Last edited by KrIsMa (2013-03-25 17:48:32)
Offline
KrIsMa wrote:
veggieman001 wrote:
An ID is used for something that is unique and it's used mainly with Javascript for selecting the content or modifying an object.
but can't you use an open selection like .warning {css blah}?
There's a specific function in Javascript, getElementById("elementid"), to get an element by its #elementid. There's also getElementsByClassName, but that gets an array.
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/
That's beside the point.
Last edited by veggieman001 (2013-03-25 17:49:23)
Offline
veggieman001 wrote:
KrIsMa wrote:
veggieman001 wrote:
An ID is used for something that is unique and it's used mainly with Javascript for selecting the content or modifying an object.
but can't you use an open selection like .warning {css blah}?
There's a specific function in Javascript, getElementById("elementid"), to get an element by its #elementid. There's also getElementsByClassName, but that gets an array.
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/That's beside the point.
oh cool thank you!
since we are on the topic html, what is the cascading part of CSS anyways?
Offline
veggieman001 wrote:
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/That's beside the point.
Sorry, it's just that HTML5 is so much better. I mean, if you've already got the entire webpage in HTML4 already, go right ahead, but...
Offline
jackrulez wrote:
veggieman001 wrote:
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/That's beside the point.
Sorry, it's just that HTML5 is so much better. I mean, if you've already got the entire webpage in HTML4 already, go right ahead, but...
KrIsMa wrote:
cause i like deprecated attributes cause i am style free XD
plus, i have a image free browser.
Offline
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/
I use XHTML 1.0 (the XML version of HTML4) because it is more compatible with older browsers and the syntax isn't sloppy.
The reason you use an ID is to identify a specific element and saying it's unique. For example, setting the ID of the header <div> to "header" makes more sense than using class, because there's only one header <div>.
Offline
jackrulez wrote:
veggieman001 wrote:
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/That's beside the point.
Sorry, it's just that HTML5 is so much better. I mean, if you've already got the entire webpage in HTML4 already, go right ahead, but...
I don't even know what the module thingamajig is!
Offline
jvvg wrote:
jackrulez wrote:
Dude.
HTML5 is the future. Why are you using HTML4? :/I use XHTML 1.0 (the XML version of HTML4) because it is more compatible with older browsers and the syntax isn't sloppy.
The reason you use an ID is to identify a specific element and saying it's unique. For example, setting the ID of the header <div> to "header" makes more sense than using class, because there's only one header <div>.
oh so it reduces confusion - and makes things unique?
thanks!
Last edited by KrIsMa (2013-03-25 17:58:58)
Offline
KrIsMa wrote:
I have a question, what is the cascading part in CSS?
Inline Styles take priority over stylesheet styles, which take priority over user agent stylesheet (standard) styles/
Offline
Laternenpfahl wrote:
KrIsMa wrote:
I have a question, what is the cascading part in CSS?
Inline Styles take priority over stylesheet styles, which take priority over user agent stylesheet (standard) styles/
hmm, whats a user agent stylesheet?
Is it the paragraph things (<h1>)?
Last edited by KrIsMa (2013-03-25 22:37:42)
Offline
KrIsMa wrote:
Laternenpfahl wrote:
KrIsMa wrote:
I have a question, what is the cascading part in CSS?
Inline Styles take priority over stylesheet styles, which take priority over user agent stylesheet (standard) styles/
hmm, whats a user agent stylesheet?
Is it the paragraph things (<h1>)?
Isn't that simply the code in a .css doc a writer creates?
Offline
mythbusteranimator wrote:
KrIsMa wrote:
Laternenpfahl wrote:
Inline Styles take priority over stylesheet styles, which take priority over user agent stylesheet (standard) styles/hmm, whats a user agent stylesheet?
Is it the paragraph things (<h1>)?Isn't that simply the code in a .css doc a writer creates?
No, a user agent stylesheet is the default stylesheet of your user agent (usually a browser)
Offline
KrIsMa wrote:
jackrulez wrote:
veggieman001 wrote:
That's beside the point.Sorry, it's just that HTML5 is so much better. I mean, if you've already got the entire webpage in HTML4 already, go right ahead, but...
KrIsMa wrote:
cause i like deprecated attributes cause i am style free XD
plus, i have a image free browser.
Sorry, I really need to read backwards in the topic.
Offline
veggieman001 wrote:
mythbusteranimator wrote:
KrIsMa wrote:
hmm, whats a user agent stylesheet?
Is it the paragraph things (<h1>)?Isn't that simply the code in a .css doc a writer creates?
No, a user agent stylesheet is the default stylesheet of your user agent (usually a browser)
So like <h1> elements are being controlled by user agent style sheets by default? Sorry I just jumped into HTML!
Offline
KrIsMa wrote:
veggieman001 wrote:
mythbusteranimator wrote:
Isn't that simply the code in a .css doc a writer creates?No, a user agent stylesheet is the default stylesheet of your user agent (usually a browser)
So like <h1> elements are being controlled by user agent style sheets by default? Sorry I just jumped into HTML!
<h1> are automatically a default setting (for example, 30px font, Angelica, black, etc.) (which can be changed if you change the fonts), but you can edit it with the ".h1" class in CSS.
Offline
mythbusteranimator wrote:
KrIsMa wrote:
veggieman001 wrote:
No, a user agent stylesheet is the default stylesheet of your user agent (usually a browser)So like <h1> elements are being controlled by user agent style sheets by default? Sorry I just jumped into HTML!
<h1> are automatically a default setting (for example, 30px font, Angelica, black, etc.) (which can be changed if you change the fonts), but you can edit it with the ".h1" class in CSS.
Yes thank you!
Does that mean the user agent style sheets control these headings by default?
Offline
KrIsMa wrote:
mythbusteranimator wrote:
KrIsMa wrote:
So like <h1> elements are being controlled by user agent style sheets by default? Sorry I just jumped into HTML!<h1> are automatically a default setting (for example, 30px font, Angelica, black, etc.) (which can be changed if you change the fonts), but you can edit it with the ".h1" class in CSS.
Yes thank you!
Does that mean the user agent style sheets control these headings by default?
Yes, however, if you change the default settings (size, color, font), the h1 will change.
You can edit it just by itself in CSS, for example, this is what I did:
.h1 { /* For headers */
font-size: 20px;
color: #0B6138;
font-family:"Times New Roman", Times, serif;
}
Offline
mythbusteranimator wrote:
KrIsMa wrote:
mythbusteranimator wrote:
<h1> are automatically a default setting (for example, 30px font, Angelica, black, etc.) (which can be changed if you change the fonts), but you can edit it with the ".h1" class in CSS.Yes thank you!
Does that mean the user agent style sheets control these headings by default?Yes, however, if you change the default settings (size, color, font), the h1 will change.
You can edit it just by itself in CSS, for example, this is what I did:.h1 { /* For headers */
font-size: 20px;
color: #0B6138;
font-family:"Times New Roman", Times, serif;
}
Actually, that should just be "h1" rather than ".h1", since it's the element rather than the class.
Offline
veggieman001 wrote:
mythbusteranimator wrote:
KrIsMa wrote:
Yes thank you!
Does that mean the user agent style sheets control these headings by default?Yes, however, if you change the default settings (size, color, font), the h1 will change.
You can edit it just by itself in CSS, for example, this is what I did:.h1 { /* For headers */
font-size: 20px;
color: #0B6138;
font-family:"Times New Roman", Times, serif;
}
Actually, that should just be "h1" rather than ".h1", since it's the element rather than the class.
Really? My HTML book says that .h1 applies this style sheet to all h1 elements.
Offline
KrIsMa wrote:
veggieman001 wrote:
mythbusteranimator wrote:
KrIsMa wrote:
Yes thank you!
Does that mean the user agent style sheets control these headings by default?Yes, however, if you change the default settings (size, color, font), the h1 will change.
You can edit it just by itself in CSS, for example, this is what I did:
Actually, that should just be "h1" rather than ".h1", since it's the element rather than the class.
Really? My HTML book says that .h1 applies this style sheet to all h1 elements.
That doesn't work.
In this example, if .h1 were applied to h1 elements, the header would be blue (because the latest instruction takes precedence).
Offline