Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
How to use DIV ID multiple times properly?
Old 07-23-2010, 09:33 PM How to use DIV ID multiple times properly?
Skilled Talker

Posts: 78
Trades: 0
Hello -

I am building an e-commerce page that will spit out multiple products using the same code - so I need to be able to use the code multiple times. Unfortunately, I need a sort of box created with width, height, margins, etc - which from what I know can't be specified on a Span class or Div class. How can this be done the right way, since validation says not to reuse Div tags?

Code:
<div id="product">
<img src="images/product.jpg" width="164" height="223">
Mens Shirt<br>79.95
</div>



#product {
	width: 164px;
	height: 286px;
	float: left;
	margin: 0 8px 0 8px;
	padding: 0;
	text-align: center;
}
Boar is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-23-2010, 10:46 PM Re: How to use DIV ID multiple times properly?
Extreme Talker

Posts: 168
Name: James
Location: Australia
Trades: 0
I take it that you mean to have the same ID in more than one DIV tag on the same page.

I always felt that the use of class would use the CSS in the exact same way as an ID tag.

I always use height, width, margin and padding attributes with the use of class.
TRANZIT JIM is offline
Reply With Quote
View Public Profile Visit TRANZIT JIM's homepage!
 
Old 07-24-2010, 01:23 AM Re: How to use DIV ID multiple times properly?
Skilled Talker

Posts: 78
Trades: 0
Quote:
Originally Posted by TRANZIT JIM View Post
I take it that you mean to have the same ID in more than one DIV tag on the same page.

I always felt that the use of class would use the CSS in the exact same way as an ID tag.

I always use height, width, margin and padding attributes with the use of class.
Yes, in order to be compliant I will need to make this a class ideally; however, height, width, etc. do not behave properly with classes - I am pretty sure those are only ID properties because they never display the same for me..

Perhaps someone can modify my code into classes and prove me wrong.
Boar is offline
Reply With Quote
View Public Profile
 
Old 07-24-2010, 08:23 AM Re: How to use DIV ID multiple times properly?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
change the '#' to '.' (full stop, dot, period) and id=" to class="
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-24-2010, 10:13 AM Re: How to use DIV ID multiple times properly?
Junior Talker

Posts: 3
Name: feras
Trades: 0
u need to use class instead of id
fedail is offline
Reply With Quote
View Public Profile
 
Old 07-24-2010, 03:20 PM Re: How to use DIV ID multiple times properly?
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
I am pretty sure those are only ID properties
No, they are NOT at all limited to ID's. However, you do need to learn and understand how SPECIFICITY works in CSS.

http://www.smashingmagazine.com/2010...d-inheritance/
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 07-26-2010, 01:40 PM Re: How to use DIV ID multiple times properly?
Skilled Talker

Posts: 78
Trades: 0
Okay thanks for the replies, it seems to be working fine. I think maybe I couldn't get this to work originally because I was assigning the class with a span rather than div which didn't hold the height/width attributes.
Boar is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to use DIV ID multiple times properly?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.23201 seconds with 12 queries