Jump to content
Stef's Coding Community

Multiple ID's in Div Tag


Recommended Posts

Hi!  First post on this site.  I finished the HTML course and just finished the CSS course a few days ago.  I'm taking a few week off before I start javascript to practice HTML and CSS.  So, here is what I want to know: 

I have an id called #main and an id called #css-table.  

Is there a way to put both of those in one div like <div id="main" "css-table">  or would <div id="main" id="css-table"> work?  I was playing around with both and could not get either one to work. 

Thanks. 

Link to post
Share on other sites

There are few ways to handle this. First rule, you can't apply two IDs to a tag. IDs have to be unique. 

So I would use one ID to apply all your CSS to the tag in question. Or a class if you plan on using the CSS rules more than once in a page. 

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...