HTML Tutorial


 Forum HomeForum Home   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!
body/div width
Post new topic   Reply to topic    HTML Help Forum Index -> CSS
View previous topic :: View next topic  
Author Message
lswing



Joined: 07 Nov 2008
Posts: 2

PostPosted: Fri Nov 07, 2008 6:45 pm     body/div width Reply with quote

Created first web page using CSS and have a couple of questions. It's a very simple site but not sure if I've gone overboard with widths.
Have body, three div's, and a table and other enters and wondering in which one I need to set page widths?

Code starts with;
<body>
<div class="1"> (to set outer border)
<div class="2"> (to set 2nd inner border and page width)
(Wanted a double border with different colors and two divs is the only way I could figure it out.)

<p> blah blah </P>
<table>
etc
etc
etc
</table>
<div> blah blah </div>

</div>
</div>
</body>
</html>

I have set a width in body, div, div1, div2, and table. Do I need to do this or just set one width?
I've set all widths the same as div2. Div1 is slightly larger to get a double colored border.
I'd like a width that will fill the screen of a 17" monitor set at 800x600px, ~760px.

Suggestions please,
PayneLess Designs



Joined: 28 Feb 2007
Posts: 1417
Location: Biloxi, MS

PostPosted: Fri Nov 07, 2008 7:14 pm     Reply with quote

You could set a border for the body tag, then set a border for the page width (wrapper div):

Play with this and modify as needed:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="generator" content="MSS Website Studio by van IJperen Software Inc. - http://www.marsansoft.nl">
<style type="text/css">
body {
height: 600px;
border: 25px inset #f00;
}

div#wrapper {
width: 95%;
height: 550px;
margin: 10px;
margin: 0 auto;
border: 25px inset #0f0;
}
</style>
</head>
<body>
<div id="wrapper">

Contents here

</div>
</body></html>
I don't use and hate tables, so will let you complete that part.
lswing



Joined: 07 Nov 2008
Posts: 2

PostPosted: Fri Nov 07, 2008 9:05 pm     Reply with quote

Here's my CSS. Main question is do I need as many "widths" as I have below in different entries?
Will play with border also.
1st shot at css. Still building web site(www.ofallonmohistory.org) and css. We're justa bunch of volunteers. Smile


li.p {
margin: 0px 20px 0px 20px;
padding-bottom: 10px;
}
li.top{
margin: 0px 20px 0px 20px;
padding-bottom: 10px;
padding-top: 25px;
}
li {
margin: 0px 20px 0px 20px;
}
div.page {
margin-left: auto;
margin-right: auto;
padding: 0px 0px 0px 0px;
width: 745px;
border: 10px solid #890D03;
}
div.page1 {margin-left: auto;
margin-right: auto;
padding: 0px 0px 0px 0px;
width: 735px;
border: 5px solid #C4112F;
}


tr {
padding: 0px;
border: 0px;
width: 735px;
}

div {
margin-left: auto;
margin-right: auto;
padding: 0px 0px 0px 0px;
width: 735px;
}

body {
text-align: center;
margin: auto auto auto auto;
width: 745px;
background: #fff8dc;
padding: 0px 0px 0px 0px;
}

a:link {
color: #000fff;
}

a:visited {
color: #ff2400;
}

p {
margin-top: 0px;
Margin-right: 15px;
margin-left:15px;
margin-bottom:0px;
font-family: "Times New Roman",Times,serif;
font-size: 16px;
text-align: left;
}

table {
width: 745px;
font-family: "Times New Roman",Times,serif;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
td.left {
padding: 0px 0px 0px 0px;
text-align: left;
margin-left: 0px;
font-size: 30px;
vertical-align: top;
width: 200px;
}
td.center {
text-align: center;
font-size: 36px;
vertical-align:top;
padding-top: 25px;
}
td.right {
text-align: right;
padding: 0px 0px 0px 0px;
vertical-align: top;
font-size:30px;
}
sticks464



Joined: 31 Dec 2006
Posts: 1284

PostPosted: Sat Nov 08, 2008 8:29 am     Reply with quote

Here's how I would code this page (Home page) using pure css and no tables.
Tested in IE6, IE7, FF3, Safari and Opera.

css
Code:
* {
   margin: 0;
   padding: 0;
   border: none;
}
body {
   text-align: center;
   background: #fff8dc;
   font-family: Arial, Helvetica, sans-serif;
   font-size: 1.2em;
   line-height: 2em;
}
html body {font-size: 100%;}
#page {
   width: 745px;
   margin: 0 auto;
   border: 10px solid #890d03;
   text-align: left;
}
#page1 {
   margin: 0 auto;
   padding-bottom:10px;
   width: 735px;
   border: 5px solid #C4112F;
}
#header {
   position: relative;
   background: url('../images/historicallogo1.jpg') no-repeat top left;
   height: 180px;
   overflow: hidden;
}

/* Top menu */
#menu {height: 21px; margin-bottom: 10px;}
#menu ul,li{
   margin:0;
   padding:0;
   list-style:none;
   text-align:center;
   white-space:nowrap;
}
#menu li{
   display:inline;
   position:relative;
   white-space:nowrap;
}
#menu li a.first{border-left:none;}

#menu a {
   border-left:1px solid #CFD3E2;
   font-family: Arial;
   font-size: 11px;
   text-decoration: none;
   font-weight: bold;
   color: #890d03;
   padding:4px 10px;
   line-height:21px;
}
* html #menu a {padding:2px 10px;display:inline-block;line-height:17px}
/* commented backslash hack v2 \*/
* html #menu a {height:1%;}
/* end hack */

#menu a:focus {outline:none;}
#menu a:hover{color: #c7112a;border-bottom:2px solid #c7112a;padding-bottom:2px;}
* html #menu a:hover {padding-bottom:0px;}
#home #menu a.home, #museum #menu a.museum, #gallery #menu a.gallery, #events #menu a.events, #gifts #menu a.gifts, #history #menu a.history {
color:#c7112a;
border-bottom:2px solid #c7112a;
padding-bottom:2px;
}

/* Page link styles */
a:link {color: #890d03; text-decoration: none;}
a:visited {color: #ff2400;}
a:hover{color: #c7112a;border-bottom:2px solid #c7112a;padding-bottom:2px;}
a:focus {outline:none;}

#header p {
   float: right;
   font-family:"Times New Roman", Times, serif;
   font-size:30px;
   text-align: center;
   width: 300px;
   height: 165px;
   margin: 20px 30px 0 0;
   line-height: 1.4em;
}
.clearer {height: 1px; clear: both;}
.right, .left, .center {margin: 10px 10px 15px 15px;}
.right img {float: right; margin: 0 0 10px 10px;}
.right span, .left span, .center span {font-weight: bold;}
.left {clear:right;}
.left img {float: left; margin: 0 10px 10px 0;}
.center {clear: left;}
.off {text-align: center;}
.names {
   width: 350px;
   margin: 0 auto 15px auto;
   white-space:nowrap;
   text-align: right;
   border-top: 2px solid #890d03;
   border-bottom: 2px solid #890d03;
}
.names span {
   float: left;
   text-align: left;
}

/* Bottom menu */
#footer {height: 50px;}
#footer ul,li{
   margin:0;
   padding:0;
   list-style:none;
   text-align:center;
   white-space:nowrap;
}
#footer li{
   display:inline;
   position:relative;
   white-space:nowrap;
}
#footer li a.first{border-left:none;}
#footer a {
   border-left:1px solid #CFD3E2;
   font-family: Arial;
   font-size: 11px;
   text-decoration: none;
   font-weight: bold;
   color: #890d03;
   padding:4px 10px;
   line-height:21px;
}
* html #footer a {padding:2px 10px;display:inline-block;line-height:17px}
/* commented backslash hack v2 \*/
* html #footer a {height:1%;}
/* end hack */

#footer a:focus {outline:none;}
#footer a:hover{color: #c7112a;border-bottom:2px solid #c7112a;padding-bottom:2px;}
* html #footer a:hover {padding-bottom:0px;}
#home #footer a.home, #museum #footer a.museum, #gallery #footer a.gallery, #events #footer a.events, #gifts #footer a.gifts, #history #footer a.history {
color:#c7112a;
border-bottom:2px solid #c7112a;
padding-bottom:2px;
}

.off a {color: #890d03; text-decoration: none; }
.off a:hover{color: #c7112a;border-bottom:2px solid #c7112a;padding-bottom:2px;}
.off a:focus {outline:none;}


html
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>O'Fallon MO Historical Society- Front</title>
<link rel="stylesheet" type="text/css" href="stylesheet1.css" >
</head>
<body id="home">
<div id="page">
<div id="page1">
<div id="header">
   <p>Founded in 1974<br>to Preserve<br>O'Fallon's History</p>
</div>
<br class="clearer">
<div id="menu">
<ul>
<li><a href="index.html" class="first home">Home</a></li>
<li><a href="museum.html" class="museum">Museum</a></li>
<li><a href="photogallery.html" class="gallery">Photo Gallery</a></li>
<li><a href="events.html" class="events">Events</a></li>
<li><a href="gifts.html" class="gifts">Gifts</a></li>
<li><a href="history.html" class="history">History</a></li>
</ul>            
</div>
<marquee behavior="scroll" direction="left">The next meeting of the OHS is Dec. 1st - our annual Christmas dinner- please RSVP
</marquee>

<p class="right"><img src="images/centennialfloat.jpg" alt=""> <span>The O'Fallon Historical Society</span> was organized in 1974 to preserve and protect O'Fallon's history for future generations.  We meet four times a year at the Society's Log Cabin Museum in Civic Park on the first Monday of each quarter:  March, June, September (on the 2nd Monday due to Labor Day), and December. The December meeting is the traditional Christmas dinner and program.</p>

<p class="left"><img src="images/bicentennialbooth.jpg" alt="">
<span>New members are always welcome!</span>  Whether you've recently moved to O'Fallon or have been a part of our community for many years, you will always be welcomed. Dues are only $10 per year for individuals and $15 per year for couples. You can mail your membership dues along with your name, address and phone number to The O'Fallon Historical Society, P. O. Box 424, O'Fallon, Missouri 63366, or contact Lewis Swinger at 636 980-8015.</p>

<p class="center">Please take a moment to browse through our website for information on our Museum, interesting photos and history on the City of O'Fallon.  Be sure to visit our Gift Shop and see how you can purchase a copy of <span><em>O'Fallon:  A Good Place to Live</em></span>, as well as the Historical Society's <span>2009 Calendar</span> featuring vintage photos of O'Fallon's historic schools and churches.</p>

<p class="off" style="text-align:center;">Officers:</p>
<p class="names"><span>President:  Lewis Swinger<br>                                                   
Treasurer:  Ollie Hibbeler</span>
Vice President:  Jim Karll<br>Secretary: Dottie Schulte </p>
 
<p class="center"> O'Fallon celebrated its Sesquicentennial in 2006. To see a recap of the events held during that historic year, visit our <a href="sesquicentennial.html">Sesquicentennial Page</a>.</p>
<br class="clearer">
<div id="footer">
<ul>
<li><a href="index.html" class="first home">Home</a></li>
<li><a href="museum.html" class="museum">Museum</a></li>
<li><a href="photogallery.html" class="gallery">Photo Gallery</a></li>
<li><a href="events.html" class="events">Events</a></li>
<li><a href="gifts.html" class="gifts">Gifts</a></li>
<li><a href="history.html" class="history">History</a></li>
</ul>            
</div>
<p class="off"><a href="mailto:infoatofallonmohistory.org">Contact Us</a></p>
</div>
</body>
</html>
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> 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 

 
HOSTING / DESIGN
MAKE MONEY

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