-
1. Re: CSS Width percentage layout issues
pziecina Jan 18, 2010 7:32 AM (in response to janken71)Hi
There are a number of things that 'may' work, but there are no guarantees.
See - http://www.positioniseverything.net/explorer/percentages.html.
PZ
-
2. Re: CSS Width percentage layout issues
janken71 Jan 18, 2010 8:45 AM (in response to pziecina)I tried some of the work-arounds, to no avail =(
What is the usual solution for a percentage based navigation? Or are the fixed-pixel widths preferred for exactly this compatibility reason?
-
3. Re: CSS Width percentage layout issues
pziecina Jan 18, 2010 8:52 AM (in response to janken71)Hi
You could use IECC's for just IE6 using pixels widths, that way all other browsers would still have a percentage based layout.
IECC's - http://www.quirksmode.org/css/condcom.html.
PZ
-
4. Re: CSS Width percentage layout issues
janken71 Jan 18, 2010 9:34 AM (in response to pziecina)I attempted to wrap the appropriate CSS in those conditional comments, but something still doesn't seem to be working right. The widths are still being calculate off the main CSS:
#navcontainer {
float:left;
font-family: Arial, Helvetica, sans-serif;
width: 1002px;
background-color:#05406E;
overflow:hidden;
}
/* to stretch the container div to contain floated list */
#navcontainer:after {
display: block;
line-height: 1px;
font-size: 1px;
clear: both;
}
<!- -[if IE 6]>
ul#navlist li {
display: block;
float: left;
width:100px;
margin: auto;
padding: 0 0 0 0;
}
ul#navlist li a {
display: block;
width: 100px;
padding: 0.4em;
border-width: 3px;
border-color: #05406E;
border-style: solid;
color: #FFFFFF;
text-decoration: none;
background: #003366;
}
<![endIf]-->
ul#navlist {
list-style: none;
padding: 0 0 0 0;
margin: auto;
/*width: 1002px;*/
font-size: 10pt;
}
ul#navlist li {
display: block;
float: left;
width:167px;
/*width: 16.6%;*/
margin: auto;
padding: 0 0 0 0;
}
ul#navlist li a {
display: block;
width: 167px;
padding: 0.4em;
border-width: 3px;
border-color: #05406E;
border-style: solid;
color: #FFFFFF;
text-decoration: none;
background: #003366;
}
#navcontainer>ul#navlist li a {
width: auto;
}
ul#navlist li#active a {
background: #003366;
color: #FFFFFF;
}
ul#navlist li a:hover, ul#navlist li#active a:hover {
color: #003366;
background: #A8CBE9;
}
Did I do something wrong?
-
5. Re: CSS Width percentage layout issues
pziecina Jan 18, 2010 9:53 AM (in response to janken71)Hi
Did you format the IECC correctly and enclose the css inside this, e.g. -
<!--[if IE6]>
<style type="text/css">
/* place css fixes for the version of IE here */
</style>
<![endif]-->PZ
-
6. Re: CSS Width percentage layout issues
janken71 Jan 18, 2010 10:25 AM (in response to pziecina)Yes I used the conditional comments:
<!--[if IE 6]>
ul#navlist li {
display: block;
float: left;
width:100px;
margin: auto;
padding: 0 0 0 0;
}
ul#navlist li a {
display: block;
width: 100px;
padding: 0.4em;
border-width: 3px;
border-color: #05406E;
border-style: solid;
color: #FFFFFF;
text-decoration: none;
background: #003366;
}
<![endIf]-->
I assume that by doing this, IE 6 will use these styles instead of the ones outside of the comments? Or do I need to do something else?
Also, I placed them in the external stylesheet. Does it need to be in the main HTML document?
-
7. Re: CSS Width percentage layout issues
pziecina Jan 18, 2010 10:27 AM (in response to janken71)Hi
You missed the -
<style type="text/css">
and
</style>
inside the iecc.
PZ
-
8. Re: CSS Width percentage layout issues
pziecina Jan 18, 2010 10:33 AM (in response to janken71)Hi
Once you have the iecc working, you can move the styles to an external link, and replace the css with the link to the css file -
<!--[if IE6]>
<style type="text/css"> /* <-- remove this line if linking to css file but leave if importing it */
/* place the link here */
</style> /* <-- remove this line if linking to css file but leave if importing it */
<![endif]-->PZ
-
-
10. Re: CSS Width percentage layout issues
janken71 Jan 18, 2010 10:39 AM (in response to pziecina)Actually, scratch my last post. It does seem to be working with the IECC placed internally rather than in my external stylesheet. Thanks so much for your help, once again =)
-
11. Re: CSS Width percentage layout issues
pziecina Jan 18, 2010 10:43 AM (in response to janken71)Hi
Thank you for the image, it helped as I could not get the page to render in super preview, try -
display: inline;
white-space: nowrap;
PZ



