Jump to content

Divs and Safari


perryc

Recommended Posts

Can someone explain to me how to fix my divs so they display correctly in safari. I checked it with Chrome, opera, and firefox and it worked in all of those correctly besides safari not sure why the margins in it will not register.

 

 

 

Thanks,

 

 

 

 

Cody Perry

Link to comment
Share on other sites

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Perry's Design - Home</title>

<link href="stylesheet/perrys_design.css" rel="stylesheet" type="text/css" />

<!--[if IE 5]>

<style type="text/css">

/* place css box model fixes for IE 5* in this conditional comment */

.twoColFixLtHdr #sidebar1 { width: 230px; }

</style>

<![endif]-->

<!--[if IE]>

<style type="text/css">

/* place css fixes for all versions of IE in this conditional comment */

.twoColFixLtHdr #sidebar1 { padding-top: 30px; }

.twoColFixLtHdr #mainContent { zoom: 1; }

/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */

</style>

<![endif]-->

<style type="text/css">

<!--

body,td,th {

color: #000;

}

#apDiv1 {

position:absolute;

left:1210px;

top:165px;

width:1px;

height:0px;

z-index:1;

}

#apDiv2 {

position:absolute;

left:737px;

top:187px;

width:213px;

height:179px;

z-index:1;

}

#apDiv3 {

position:absolute;

left:761px;

top:76px;

width:539px;

height:453px;

z-index:2;

}

#apDiv4 {

position:absolute;

left:1125px;

top:186px;

width:271px;

height:203px;

z-index:2;

}

#apDiv5 {

position:absolute;

left:738px;

top:390px;

width:272px;

height:20px;

z-index:3;

}

#apDiv6 {

position:absolute;

left:1125px;

top:394px;

width:273px;

height:17px;

z-index:4;

}

#apDiv7 {

position:absolute;

left:800px;

top:529px;

width:509px;

height:170px;

z-index:5;

}

-->

</style></head>

 

<body class="twoColFixLtHdr">

<div id="apDiv2"><img src="images/graphic_design_image.jpg" width="272" height="201" alt="Image of a team working towards a common goal" /></div>

<div id="apDiv4"><img src="images/good_web_design.jpg" width="273" height="207" alt="Image of web designers constructing web pages" /></div>

<div id="apDiv5"><strong><a href="#">Graphic Design</a></strong></div>

 

<div id="apDiv6"><strong><a href="#">Web Design</a></strong></div>

<div id="apDiv7"><img src="images/web_hosting_banner.png" width="504" height="172" /></div>

<div id="container">

<div id="header">

<h1> </h1>

<p>

<!-- end #header -->

</p>

<p> </p>

</div>

 

<div id="sidebar1">

<h3> </h3>

<p><strong>Home</strong></p>

<p><strong>About</strong> </p>

<p><strong>Portfolio</strong> </p>

<p><strong>Documents</strong> </p>

 

<p><strong>Contact</strong></p>

<p> </p>

<h3> </h3>

<p> </p>

<p><strong>Contact Information</strong> </p>

<p><em><strong>Phone: </strong></em></p>

<p><em>(724)-681-3724</em> </p>

 

<p><em><strong>Email:</strong></em></p>

<p><em>perryc@perrysdesign.com</em></p>

<p> </p>

<p> </p>

<!-- end #sidebar1 --></div>

<div id="mainContent">

<div id="web design">

<p>  </p>

 

<p> </p>

<p> </p>

</div>

<h1> </h1>

<!-- end #mainContent --></div>

<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />

<div id="footer">

<p>Copyright © Cody Perry : Perry's Design. All Rights Reserved.</p>

 

<!-- end #footer --></div>

<!-- end #container --></div>

</body>

</html>

 

 

 

Now when i do it the sidebar1 div the text does not show centered and the footer div does not show a black background color ans it should be centered with white lettering on black.

 

 

Thanks,

 

 

 

 

Cody Perry

Link to comment
Share on other sites

You'll also need to post the code from stylesheet/perrys_design.css.

 

Also, why the many absolutely positioned elements? (I'm also assuming that you plan to move the inline CSS in the <head> section of the document into an external stylesheet). Using many absolutely positioned elements usually leads to trouble if the site is viewed at different resolutions. For example, what does the site look like when you use 1024x768?

 

I would highly suggest you stick with floats rather than position:absolute.

Link to comment
Share on other sites

Ya, the problem im having with using the floated divs is that i cant get them to line up next to each other it always goes under the div or in the same div when i insert it.

 

 

Thanks,

 

 

 

 

 

Cody Perry

 

 

 

Heres the CSS StyleSheet

 

 

@charset "UTF-8";

body {

background: #F2F2F2;

margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */

padding: 0;

text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */

color: #FFF;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 100%;

font-weight: normal;

}

.twoColFixLtHdr #container {

width: 930px; /* the auto margins (in conjunction with a width) center the page */

border: 1px solid #000000;

text-align: left; /* this overrides the text-align: center on the body element. */

margin-top: 0;

margin-right: auto;

margin-bottom: 0px;

margin-left: auto;

background-color: #F2F2F2;

}

.twoColFixLtHdr #header {

background-color: #000;

height: 143px;

padding-top: 0;

padding-right: 10px;

padding-bottom: 0;

padding-left: 20px;

width: 900px;

background-image: url(../images/perrys_design_header.jpg);

font-family: Arial, Helvetica, sans-serif;

font-weight: bold;

font-variant: normal;

color: #FFF;

}

.twoColFixLtHdr #header h1 {

margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */

padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */

}

.twoColFixLtHdr #sidebar1 {

float: left; /* since this element is floated, a width must be given */

width: 200px; /* the background color will be displayed for the length of the content in the column, but no further */

padding: 15px 10px 15px 20px;

background-color: #F2F2F2;

text-align: center;

color: #000;

font-size: 100%;

font-family: Verdana, Arial, Helvetica, sans-serif;

}

.twoColFixLtHdr #mainContent {

margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */

padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */

text-align: center;

}

.twoColFixLtHdr #footer {

padding: 0 10px 0 20px;

background-color: #000;

color: #FFF;

font-family: Arial, Helvetica, sans-serif;

font-size: 18px;

text-align: center;

}

.twoColFixLtHdr #footer p {

margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */

padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */

background-color: #000;

text-align: center;

}

.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */

float: right;

margin-left: 8px;

}

.fltlft { /* this class can be used to float an element left in your page */

float: left;

margin-right: 8px;

}

.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */

clear:both;

height:0;

font-size: 1px;

line-height: 0px;

}

#navbar {

font-family: Arial, Helvetica, sans-serif;

background-color: #000;

color: #FFF;

margin: 0px;

padding: 0px;

text-align: center;

}

Link to comment
Share on other sites

I just don't know how to get floating divs to line up next to each other they always go under inside of that same div or above which is why im having a hard time right now.

 

 

 

Thanks,

 

 

 

 

Cody Perry

Link to comment
Share on other sites

Im not sure how to get divs to line up next to each other im only able to get them below one another or above mostly. I cant set them up next to one another. Thats my problem right now.

 

And im getting a black line with the footer that reaches across the entire screen.

 

 

 

Thanks,

 

 

 

 

Cody Perry

Link to comment
Share on other sites

If you're floating them and they don't line up next to each other, make them less wide - chances are, there's not enough room.

 

It's easiest to make them substantially smaller just to see if that's the cause. In general, you have to count margins, paddings, borders, and the content to get the actual width.

Link to comment
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...