HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
setting attributes in <div> tag
Post new topic   Reply to topic    HTML Help Forum -> CSS
View previous topic :: View next topic  
Author Message
jenniferesme



Joined: 02 Apr 2005
Posts: 4

PostPosted: Thu Apr 14, 2005 6:27 am     setting attributes in <div> tag Reply with quote

I have used the <div class="leftbox"></div> tags to make a box, and I want to change only that stuff in the box to float left and have a 30% width. I can't figure out how to do this using CSS style. Thank you.

<div class="leftbox" >
{width:30%;float:left}

<h5> <a href="const.htm">Antiques</a></h5>
<h5><a href="const.htm">Books</h5>
<h5><a href="const.htm">Clothes</a></h5>
<h5><a href="const.htm">Electronics</a></h5>
<h5><a href="const.htm">Furniture</a></h5>
<h5><a href="const.htm">Jewelry</a></h5>
<h5><a href="const.htm">Music and Videos</a></h5>
<h5><a href="const.htm">Sporting Goods</a></h5>
</div>
degsy



Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK

PostPosted: Thu Apr 14, 2005 6:39 am     Reply with quote

Code:
<div class="leftbox" style="width:30%;float:left">

or
Code:
<style>
.leftbox {
   width:30%;
   float:left
}
</style>

http://www.w3schools.com/css/default.asp
jenniferesme



Joined: 02 Apr 2005
Posts: 4

PostPosted: Thu Apr 14, 2005 6:48 am     follow up ? Reply with quote

Many thanks! I assume, then, that if I want to make further changes (like font color) I need to put it into the <style> tags?
degsy



Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK

PostPosted: Thu Apr 14, 2005 8:00 am     Reply with quote

Yes, once you have defined the class you can add/alter it to suit

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
.leftbox {
   font-family: Arial, Helvetica, sans-serif;
   font-size: large;
   font-weight: normal;
   color: #000000;
   background-color: #FFFFCC;
   padding: 5%;
   float: left;
   width: 30%;
   border: thin solid #000000;
}
.rightbox {
   font-family: Georgia, "Times New Roman", Times, serif;
   font-size: large;
   font-weight: bold;
   color: #FFFFFF;
   background-color: #330066;
   padding: 2%;
   width: 30%;
   margin-left: 50%;
   border: thin dashed #6600FF;
}
-->
</style>
</head>

<body>
<div class="leftbox">.leftbox {<br>
font-family: Arial, Helvetica, sans-serif;<br>
font-size: large;<br>
font-weight: normal;<br>
color: #000000;<br>
background-color: #FFFFCC;<br>
padding: 5%;<br>
float: left;<br>
width: 30%;<br>
border: thin solid #000000;<br>
}</div>
<div class="rightbox">.rightbox {<br>
font-family: Georgia, &quot;Times New Roman&quot;, Times, serif;<br>
font-size: large;<br>
font-weight: bold;<br>
color: #FFFFFF;<br>
background-color: #330066;<br>
padding: 2%;<br>
width: 30%;<br>
margin-left: 50%;<br>
border: thin dashed #6600FF;<br>
}</div>
</body>
</html>
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> CSS All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial