Jump to content

div class and div id!

Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

div class and div id! Rate Topic: -----

#21 User is offline   sypher 

  • the owner3r
  • Group: Administrators
  • Posts: 1,578
  • Joined: 04-April 06
  • Location:North Wales, UK
  • Interests:Art, Boxing, MMA, Graphic Design, Web Design etc. ;)

Posted 07 January 2007 - 08:52 PM

Quote

As far as Ids replacing Names. I'm fairly sure PHP forms still rely on names?
Yeah they do.
sypher design - North Wales Web Design | Latest Work: - Scala Cinema

CSS - Can't See Sh*t
0

#22 User is offline   Karl Buckland 

  • A.K.A. Sirkent
  • Group: Administrators
  • Posts: 2,145
  • Joined: 04-April 06
  • Gender:Male
  • Location:Kent, UK

Posted 08 January 2007 - 05:36 AM

As you can see, I've edited my first answering post (with achnowledgment) to include any additional information we brought up about the differences between using id and class in CSS.

Considering how the topic was getting quite lengthy, I thought this might be wise for when somebody else finds it!
QUOTE(benbramz @ Aug 17 2007, 07:44 AM) Ive noticed that quite a few people are now adding quotes from the board into their signature. I think its started an new web-radiance craze.. :P
0

#23 User is offline   william 

  • SEO Specialist
  • Group: Members
  • Posts: 233
  • Joined: 13-October 06
  • Gender:Male
  • Location:Gloucestershire, UK
  • Interests:SEO, Web Design, PHP Development, Wordpress, Fireworks, Photoshop, EpiServer

Posted 29 January 2007 - 04:53 AM

Am I right in thinking that it is not possible to declare child selectors from a class?

eg :

.content h1
.content h2

Normally I would use DIVs to do this, eg :

#content h1
#content h2

If so, then is it bad for me to be using more than one instance of a DIV within a page?

I have a text box that I would like to use multiple times around the page, and it needs to use different styles for a and a:hover within this text box etc, but from my understanding this cannot be done with a class...

:huh:
0

#24 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 29 January 2007 - 08:09 AM

View Postwgardner, on Jan 29 2007, 04:53 AM, said:

Am I right in thinking that it is not possible to declare child selectors from a class?

eg :

.content h1
.content h2

Actually, you'd be wrong; you can very nicely use that selector.

View Postwgardner, on Jan 29 2007, 04:53 AM, said:

Normally I would use DIVs to do this, eg :

#content h1
#content h2

If so, then is it bad for me to be using more than one instance of a DIV within a page?

It is only bad to use multiple instances of a div, on the same page, if that div has an ID. If you could give it a class, instead, then you're ok.

View Postwgardner, on Jan 29 2007, 04:53 AM, said:

I have a text box that I would like to use multiple times around the page, and it needs to use different styles for a and a:hover within this text box etc, but from my understanding this cannot be done with a class...

:huh:

I do believe, if I understand you correctly, this is a case for multiple attributes, like so:

CSS:
.textBox {property:value;}
#commentTextBox {property:value;}
#formTextBox {property:value;}


xhtml:
<div class="textBox">...content...</div>
<div class="textBox" id="commentTextBox">...content...</div>
<div class="textBox" id="formTextBox">...content...</div>


This will allow you to specify common styles that all of these boxes need to have, via the class "textBox", and then separately, individual styles each box needs to have, via their respective ids.
0

#25 User is offline   TJSingleton 

  • Allegedly Legendary
  • Group: Members
  • Posts: 517
  • Joined: 31-July 06
  • Location:Winder, GA

Posted 29 January 2007 - 08:39 PM

View Postsypher, on Jan 7 2007, 08:52 PM, said:

Yeah they do.


It has not be depreciated for the input elements, but it has for the form element itself. [As well as, a, applet, frame, iframe, img, and map. cite: http://www.w3.org/TR/xhtml1/#h-4.10]
0

#26 User is offline   Ryan Fait 

  • W.R. Sergeant
  • Group: Members
  • Posts: 204
  • Joined: 07-January 07
  • Location:Las Vegas

Posted 30 January 2007 - 04:51 AM

Personally, I only use classes unless I need to bring in JavaScript or targets. As older versions of Netscape handle classes much better than ID's with regards to CSS styling, I don't see a reason to use ID's for things when <ul class="nav"> works just as well as <ul id="nav">.
The commercial front for my freelance web design company.
0

#27 User is offline   william 

  • SEO Specialist
  • Group: Members
  • Posts: 233
  • Joined: 13-October 06
  • Gender:Male
  • Location:Gloucestershire, UK
  • Interests:SEO, Web Design, PHP Development, Wordpress, Fireworks, Photoshop, EpiServer

Posted 30 January 2007 - 06:11 AM

Brilliant - thanks all, especially Herks, that's cleared it all up for me. Think I learnt it in some kind of backward way, but now is bright and clear :)
0

#28 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 30 January 2007 - 08:23 AM

View PostRyan Fait, on Jan 30 2007, 04:51 AM, said:

Personally, I only use classes unless I need to bring in JavaScript or targets. As older versions of Netscape handle classes much better than ID's with regards to CSS styling, I don't see a reason to use ID's for things when <ul class="nav"> works just as well as <ul id="nav">.

Well, I see your point, and I'm sure I'm just being nit-picky in saying this, but using IDs for a singular element on a document is just semantically correct.

It would be like going to college and being handed a class card instead of an ID card; there truly is only one Ryan Fait in that school, but what the heck, the administration thought it best to put you in your own class of people... all by yourself.

For the second time today, {runs and hides}
0

#29 User is offline   Ryan Fait 

  • W.R. Sergeant
  • Group: Members
  • Posts: 204
  • Joined: 07-January 07
  • Location:Las Vegas

Posted 30 January 2007 - 10:26 PM

Haha, nice analogy. It is indeed true, but I also like the look of a period much better than a # :P

This post has been edited by Ryan Fait: 30 January 2007 - 10:27 PM

The commercial front for my freelance web design company.
0

#30 User is offline   moojoo 

  • Argh!
  • Group: Members
  • Posts: 449
  • Joined: 03-August 06
  • Location:Texas

Posted 31 January 2007 - 10:46 AM

View PostRyan Fait, on Jan 31 2007, 03:26 AM, said:

Haha, nice analogy. It is indeed true, but I also like the look of a period much better than a # :P


Facist. :P
Its not girly, its web 2.0!
0

#31 User is offline   lwaxhaxnc 

  • W.R. Private
  • Group: Members
  • Posts: 14
  • Joined: 24-September 11

Posted 24 September 2011 - 01:14 PM

I think you can use the id class for say your header, footer etc (as they only appear once in your page). :)
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users