PDA

View Full Version : IE css complications


dovroc
02-03-2008, 11:09 PM
Hi,
I was wondering if anyone can help. I am trying to align #cakeimages with #sidebar1 and #sidebar2 both horizontally and diagonally. this works fine in FF but the problem starts in IE where it appears completely different on both angles.

any ideas?

thanks

<!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" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
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: #000000;
background-color: #9999FF;
}

.thrColElsHdr #container {
width: 950px; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
background: #FFFFFF; /* 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: 15px;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
}
.thrColElsHdr #header {
background-color: #FFFFFF;
height: 110px;
padding-top: 0;
padding-right: 10px;
padding-bottom: 0;
padding-left: 10px;
}
.thrColElsHdr #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 */
}

.thrColElsHdr #sidebar1 {
float: left;
width: 11em; /* top and bottom padding create visual space within this div */
background-color: #D3B4E4;
height: 600px;
padding-top: 15px;
padding-right: 0;
padding-bottom: 15px;
padding-left: 0;
}
.thrColElsHdr #sidebar2 {
float: right;
width: 11em; /* top and bottom padding create visual space within this div */
background-color: #D3B4E4;
height: 600px;
padding-top: 15px;
padding-right: 0;
padding-bottom: 15px;
padding-left: 0;
font-size: 12px;
}
.thrColElsHdr #sidebar1 h3, .thrColElsHdr #sidebar1 p, .thrColElsHdr #sidebar2 p, .thrColElsHdr #sidebar2 h3 {
margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
margin-right: 10px;
}

.thrColElsHdr #mainContent {
padding: 0px;
margin-top: 0;
margin-right: 12em;
margin-bottom: 0;
margin-left: 12em;
top: 0px;
font-size: 12px;
}
#cakeimages {
background-image: url(Images/Cakesollection2.jpg);
height: 110px;
background-repeat: no-repeat;
background-position: 35px center;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
border-top-color: #9999FF;
border-right-color: #9999FF;
border-bottom-color: #9999FF;
border-left-color: #9999FF;
}
.thrColElsHdr #footer {
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
}
.thrColElsHdr #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 */
}

/* Miscellaneous classes for reuse */
.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;
}
-->
</style>
<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.thrColElsHdr #sidebar1, .thrColElsHdr #sidebar2 { padding-top: 30px; }
.thrColElsHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #000000
}
-->
</style>
</head>

<body class="thrColElsHdr">

<div id="container">
<div id="header">
<h1 align="center">BAKERS DELIGHT</h1>
<!-- end #header --></div>
<div id="sidebar1">
<ul id="MenuBar1" class="MenuBarVertical">
<li><a href="#">Home </a> </li>
<li><a href="#">About Us </a></li>
<li><a class="MenuBarItemSubmenu" href="#">Cakes </a>
<ul>
<li><a href="#">Rachels Chocolate Cake</a> </li>
<li><a href="#">Chocolate Chip Cake</a></li>
<li><a href="#">Chocolate Caramel Cheesecake</a></li>
<li><a href="#">Chocolate Lovers Cheesecake</a></li>
<li><a href="#">Amaretto Cake</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Biscuits</a>
<ul>
<li><a href="#">Tea Biscuits</a></li>
<li><a href="#">Chocolate Orange Biscuits</a></li>
<li><a href="#">Chewy Biscuits</a></li>
<li><a href="#">Coconut Oatmeal Biscuits</a></li>
<li><a href="#">Oatmeal Raisin Biscuits</a></li>
<li><a href="#">Chocolate Chip Biscuits</a></li>
<li><a href="#">Chocolate Chip Shortbread Biscuits</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Pies</a>
<ul>
<li><a href="#">Cherry Cheese Pie</a></li>
<li><a href="#">Lemon Meringue Pie</a></li>
<li><a href="#">Sunday's Apple Pie</a></li>
<li><a href="#">Fancy Fruit Pie</a></li>
<li><a href="#">Untitled Item</a></li>
</ul>
</li>
<li><a href="#">Desserts</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<h3>&nbsp;</h3>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />
<br />
</p>
<p>&nbsp;</p>
<p>
<!-- end #sidebar1 -->
</p>
</div>
<div id="sidebar2">
<h3>Popular recipes</h3>
<p>The background color on this div will only show for the length of the content. If you'd like a dividing line instead, place a border on the right side of the #mainContent div if the #mainContent div will always contain more content than the #sidebar2 div. </p>
<p>Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>
<!-- end #sidebar2 -->
</p>
</div>
<div id="mainContent"><!-- TemplateBeginEditable name="Main content" -->
<div id="cakeimages"></div>
<p>&nbsp;</p>
<p>Welcome to Bakers Delight! </p>
<p>If you love to bake then this is the website for you. Packed with all sorts of yummy recipes to keep your taste buds rocking!</p>
<p>Whether you are entertaining, baking a treat for a friend or just feeling plain peckish then come along and browse through our recipes.</p>
<h2>&nbsp;</h2>
<!-- TemplateEndEditable -->
<!-- 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 align="center"><a href="home page1.html">Home</a></p>
<!-- end #footer --></div>
<!-- end #container --></div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>

domedia
02-04-2008, 01:11 PM
dovroc, can you put this online? It's just so much easier to troubleshoot that way :)

dovroc
02-05-2008, 10:23 PM
yeah sure, here it is.

https://rachelt.sslpowered.com/home%20page1.html

Many thanks

mangofreak
02-06-2008, 04:22 PM
You have this conditional CSS, but this line:
.thrColElsHdr #mainContent { zoom: 1; padding-top: 15px; }

It is throwing the alignment off. Comment it out and test it. I did, and it displayed properly.


<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.thrColElsHdr #sidebar1, .thrColElsHdr #sidebar2 { padding-top: 30px; }
.thrColElsHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->

dovroc
02-09-2008, 09:30 PM
When you say comment it out, do you mean making it look like below? I tried doing that, but couldn't see the change.

Thanks for you help


<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.thrColElsHdr #sidebar1, .thrColElsHdr #sidebar2 { padding-top: 30px; }
/*.thrColElsHdr #mainContent { zoom: 1; padding-top: 15px; }*/
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->

mangofreak
02-10-2008, 02:23 AM
I took the line I mentioned out and everything was working well in both and

Try taking the whole conditional css out and see what happens. Once you test and compare, then you can try putting it in back one line at the time.

let me know what happens :)

dovroc
02-12-2008, 07:51 PM
I managed to sort out the previous issue and now the problem seems to be joining sidebar 1 and 2 to the bottom. This is a particular problem in IE, in firefox it looks fine.

heres the link to the webpage and code below:

https://rachelt.sslpowered.com/home%20page3.html


<!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 (http://www.w3.org/1999/xhtml%22%3E%3Chead)>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<style type="text/css">
<!--
/* Tips for Elastic layouts
1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate.
2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this.
3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing.
*/
#container {
width: 950px; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
background: #FFFFFF; /* 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: 15px;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
}
#header {
background-color: #FFFFFF;
height: 110px;
padding-top: 0;
padding-right: 10px;
padding-bottom: 0;
padding-left: 10px;
}
#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 */
}
/* Tips for sidebar1:
1. Be aware that if you set a font-size value on this div, the overall width of the div will be adjusted accordingly.
2. Since we are working in ems, it's best not to use padding on the sidebar itself. It will be added to the width for standards compliant browsers creating an unknown actual width.
3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".thrColElsHdr #sidebar1 p" rule.
*/
#sidebar1 {
float: left;
width: 11em;
padding: 15px 0;
background-color: #D3B4E4;


}
#sidebar2 {
float: right;
width: 11em;
padding: 15px 0;
background-color: #D3B4E4;

}
/* Tips for mainContent:
1. If you give this #mainContent div a font-size value different than the #sidebar1 div, the margins of the #mainContent div will be based on its font-size and the width of the #sidebar1 div will be based on its font-size. You may wish to adjust the values of these divs.
2. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends.
3. To avoid float drop, you may need to test to determine the approximate maximum image/element size since this layout is based on the user's font sizing combined with the values you set. However, if the user has their browser font size set lower than normal, less space will be available in the #mainContent div than you may see on testing.
4. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs that may occur.
*/
#mainContent {
margin: 0 12em 0 12em;
}
#cakeimages {
background-image: url(Images/Cakesollection2.jpg);
height: 110px;
background-repeat: no-repeat;
background-position: left center;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
border-top-color: #9999FF;
border-right-color: #9999FF;
border-bottom-color: #9999FF;
border-left-color: #9999FF;
}
#footer {
padding: 0 10px;
background-color: #D3B4E4;
}
#footer p {
padding-top: 10px;
padding-right: 0px;
padding-bottom: 10px;
padding-left: 0px;
margin: 0;
}
.style2 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 16px;
}
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
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: #000000;
background-color: #9999FF;
}
a:active {
color: #99CCCC;
}
.style3 {
font-size: 14px;
font-weight: bold;
}
.style4 {
font-size: 14px
}
.Style5 {
font-size: 16px;
}
a:link {
color: #9933FF;
}
a:visited {
color: #0099CC;
}
a:hover {
color: #9999FF;
}
#sidebar1 h3, #sidebar1 p, #sidebar2 p, #sidebar2 h3 {
margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
margin-right: 10px;
}
/* Miscellaneous classes for reuse */
.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;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body class="thrColElsHdr" onload="MM_preloadImages('Images/cocoaoatmeal2.jpg','Images/lemonmeringuepie2.jpg')">
<div id="container">
<div id="header">
<h1 align="center">BAKERS DELIGHT</h1>
<!-- end #header --></div>
<div id="sidebar1">
<ul id="MenuBar1" class="MenuBarVertical">
<li><a href="#">Home </a> </li>
<li><a href="#">About Us </a></li>
<li><a class="MenuBarItemSubmenu" href="#">Cakes </a>
<ul>
<li><a href="#">Rachels Chocolate Cake</a> </li>
<li><a href="#">Chocolate Chip Cake</a></li>
<li><a href="#">Chocolate Caramel Cheesecake</a></li>
<li><a href="#">Chocolate Lovers Cheesecake</a></li>
<li><a href="#">Amaretto Cake</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Biscuits</a>
<ul>
<li><a href="#">Chocolate Orange Biscuits</a></li>
<li><a href="#">Chewy Biscuits</a></li>
<li><a href="#">Coconut Oatmeal Biscuits</a></li>
<li><a href="#">Oatmeal Raisin Biscuits</a></li>
<li><a href="#">Chocolate Chip Biscuits</a></li>
<li><a href="#">Chocolate Chip Shortbread Biscuits</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Pies</a>
<ul>
<li><a href="#">Cherry Cheese Pie</a></li>
<li><a href="#">Lemon Meringue Pie</a></li>
<li><a href="#">Sunday's Apple Pie</a></li>
<li><a href="#">Fancy Fruit Pie</a></li>
<li><a href="#">Untitled Item</a></li>
</ul>
</li>
<li><a href="#">Desserts</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<h3>&nbsp;</h3>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
<div id="sidebar2">
<h3 align="center" class="Style5">Popular Recipes</h3>
<div id="Amaretto Cake">
<div align="center">
<p>Lemon Meringue Pie</p>
<p><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Lemon Meringue Pie','','Images/lemonmeringuepie2.jpg',1)"><img src="Images/lemonmeringuepie1.jpg" name="Lemon Meringue Pie" width="100" height="100" border="0" id="Lemon Meringue Pie" /></a></p>
</div>
</div>
<div align="center" id="oatmealbics">
<p>Coconut Oatmeal Biscuits</p>
<p><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Coconut Oatmeal Biscuits','','Images/cocoaoatmeal2.jpg',1)"><img src="Images/cocoaoatmeal1.jpg" alt="Coconut Oatmeal Biscuits" name="Coconut Oatmeal Biscuits" width="100" height="100" border="0" id="Coconut Oatmeal Biscuits" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</div>
<div id="mainContent"><!-- TemplateBeginEditable name="Main content" -->
<div id="cakeimages"></div>
<p>&nbsp;</p>
<blockquote>
<p class="style2"> Welcome to Bakers Delight! </p>
<p class="style2">If you love to bake then this is the website for you. Packed with all sorts of yummy recipes to keep your taste buds rocking!</p>
<p class="style2">Whether you are entertaining, baking a treat for a friend or just feeling plain peckish then come along and browse through our recipes.</p>
</blockquote>
<h2>&nbsp;</h2>
<!-- TemplateEndEditable -->
<!-- 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">
<blockquote>
<p align="center" class="style4"><a href="home page1.html">Home</a> l About Us l Cakes l Biscuits l Pies l Desserts l <a href="contact@bakersdelight.co.uk">Contact Us</a></p>
</blockquote>
<!-- end #footer --></div>
<!-- end #container --></div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>