Dysan Posted January 3, 2008 Share Posted January 3, 2008 How do I add two CSS declarations to a div? <div id="box"></div> Quote Link to comment Share on other sites More sharing options...
neilfurry Posted January 3, 2008 Share Posted January 3, 2008 There are two ways to access CSS using div tags 1. class 2. id Eg: <div id='box' class='box2'></div> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 3, 2008 Share Posted January 3, 2008 How do I add two CSS declarations to a div? <div id="box"></div> why - you can include all of your styles in one class? you can create two separate classes and use javascript to switch the class of the div. Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted January 4, 2008 Share Posted January 4, 2008 you can only call one id, but you have no limit to how many classes you can call within a div. You simply separate them by a space. To declare two declarations do this: #box { declaration: one; declaration: two; padding: 10px; margin: 0 auto; } Quote Link to comment Share on other sites More sharing options...
SuperBlue Posted January 4, 2008 Share Posted January 4, 2008 It is possible to add more than one class to HTML elements. Example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="eng"> <head> <style type="text/css"> .bold { font-weight: bold; } .italic { font-style: italic; } .big.underline { font-size: 2em; text-decoration: underline; } </style> </head> <body> <p class="bold italic">This is written in bold and italic!<p> <p class="big underline">This is written in a bigger font-size, and with an underline!<p> </body> </html> Supported by most useable browsers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.