|
 |
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
|
|
11-17-2008, 10:23 PM
|
PM User |
#1
|
|
Regular Coder
Join Date: Jun 2008
Posts: 113
Thanks: 27
Thanked 0 Times in 0 Posts
|
margin: auto problem in IE
I tried to use the following code to center a div on a page. It works in FF, but not in IE. Any ideas?
Code:
#supportBtns {
margin: auto;
width: 400px;
}
Thanks.
|
|
|
|
11-17-2008, 10:43 PM
|
PM User |
#2
|
|
Senior Coder
Join Date: Oct 2007
Location: Cowboy Nation
Posts: 2,171
Thanks: 173
Thanked 257 Times in 257 Posts
|
what other code do you have surrounding it? Do u have a site or maybe more code and HTML to post? Could help.
__________________
Generic signature comment!
|
|
|
11-17-2008, 11:00 PM
|
PM User |
#3
|
|
Regular Coder
Join Date: Jun 2008
Posts: 113
Thanks: 27
Thanked 0 Times in 0 Posts
|
html:
Code:
<html>
<head>
<title>xxxxxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- xxxxx -->
<link href="style_sheet.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
function mmLoadMenus() {
if (window.mm_menu_1010151047_0) return;
window.mm_menu_1010151047_0 = new Menu("root",188,20,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#FFFFFF","#FFFFFF","#3366CC","right","middle",5,0,1000,-5,7,true,true,true,0,true,true);
mm_menu_1010151047_0.addMenuItem("Adobe ® Reader ®","window.open('http://www.adobe.com/products/acrobat/readstep2.html', '_blank');");
mm_menu_1010151047_0.addMenuItem("Apple ® QuickTime ®","window.open('http://www.apple.com/quicktime/download', '_blank');");
mm_menu_1010151047_0.addMenuItem("Java ™ Plug-in","window.open('http://www.java.com/en/download/index.jsp', '_blank');");
mm_menu_1010151047_0.addMenuItem("Macromedia ® Flash ™","window.open('http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash', '_blank');");
mm_menu_1010151047_0.addMenuItem("Macromedia Shockwave ®","window.open('http://www.adobe.com/shockwave/download/', '_blank');");
mm_menu_1010151047_0.hideOnMouseOut=true;
mm_menu_1010151047_0.bgColor='#FFFFFF';
mm_menu_1010151047_0.menuBorder=1;
mm_menu_1010151047_0.menuLiteBgColor='#FFFFFF';
mm_menu_1010151047_0.menuBorderBgColor='#999999';
mm_menu_1010151047_0.writeMenus();
} // mmLoadMenus()
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_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_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>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body>
<script language="JavaScript1.2">mmLoadMenus();</script>
<div id="container">
<div id="banner"><img src="images/banner.gif" border="0" usemap="#Map" />
<map name="Map"><area shape="rect" coords="-4,3,658,127" href="http://www.brooklyn.liu.edu/ " target="_blank" alt="Long Island University - Brooklyn">
<area shape="rect" coords="661,3,794,106" href="http://www.pearsoncustom.com" target="_blank" alt="Pearson Custom Publishing">
</map>
</div>
<div id="navBar"><img src="images/navbar_main.jpg" border="0" usemap="#Map2" />
<map name="Map2">
<area shape="rect" coords="78,4,206,29" href="mycommunicationlab/index.html" target="_blank" alt="MyCommunicationLab">
<area shape="rect" coords="264,4,341,28" href="study_skills/index.html" target="_blank" alt="Study Skills">
<area shape="rect" coords="392,3,510,31" href="research_navigator/index.html" target="_blank" alt="Research Navigator">
<area shape="rect" coords="563,3,688,31" href="instructor/index.html" target="_blank" alt="Instructor Resources">
</map>
</div>
<div id="plugs"><a href="#" name="link2" id="link1" onMouseOver="MM_showMenu(window.mm_menu_1010151047_0,-80,17,null,'link2')" onMouseOut="MM_startTimeout();">Suggested Plugins</a>
</div>
<div id="header"><img src="images/welcome.gif" alt="Welcome" width="303" height="32" /><br />
<p>Long Island University - Brooklyn Campus <br/> website
for Speech Communication<br /></p>
</div>
<img src="images/border1.jpg" width="664" height="1" />
<div id="main">
<div id="mainLeft">
<p id="subheader"><br />Follow the steps below to register for MyCommunicationLab.</p><br /><br />
<ul>
<li><img src="images/button1.gif" align="absmiddle"> See written registration
<a href="resources/liu_student_registration_login_mcl_handout.doc" target="_blank">instructions</a>
</li>
<li><img src="images/button2.gif" align="absmiddle"> <a href="https://register.pearsoncmg.com/reg/register/reg1.jsp" target="_blank">Register</a> for MyCommunicationLab 0205545777
</li>
<li><img src="images/button3.gif" align="absmiddle"> <a href=" http://mycommunicationlab.mathxl.com/mywebs/login.asp" target="_blank">LOGIN</a> for returning users
<a href=" http://mycommunicationlab.mathxl.com/mywebs/login.asp" target="_blank"><img src="images/logo_mylab.gif" width="195" height="43" align="absmiddle"></a>
</li>
</ul>
</div>
<div id="mainRight">
<img src="images/0205491464_i.jpg" width="170" height="228" alt="Devito, Essentials of Human Communication" /><br />
<p>Devito, Essentials of Human Communication</p>
</div>
</div>
<div id="support"><img src="images/border2.jpg"><br />
<div id="supportBtns"><img src="images/plugins.gif" width="150" height="26" border="0" usemap="#Map3"><map name="Map3"><area shape="rect" coords="-20,-5,28,25" href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank" alt="Adobe Acrobat"><area shape="rect" coords="30,-10,61,31" href="http://www.apple.com/quicktime/download" target="_blank" alt="Apple Quicktime"><area shape="rect" coords="60,-8,89,33" href="http://www.java.com/en/download/index.jsp" target="_blank" alt="Java Plugin"><area shape="rect" coords="89,1,118,39" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank" alt="Adobe Flash Player"><area shape="rect" coords="119,-7,160,40" href="http://www.adobe.com/shockwave/download/" target="_blank" alt="Adobe Shockwave"></map><a href="http://247.pearsoned.com" target="_blank"><img src="images/247_support.gif" width="141" height="26"></a><a href="http://www.etipsforagrades.com" target="_blank"><img src="images/etips.gif" width="85" height="26"></a>
</div><img src="images/border2.jpg">
</div>
<div id="footer">
<p>© 2008 <a href="http://www.pearsoncustom.com" target="_blank">Pearson Custom Publishing</a> | All Rights Reserved | A Division of Pearson Education</p>
</div>
</div>
</body>
</html>
CSS:
Code:
* {
margin: 0px;
padding: 0px;
border: 0px;
}
body {
background-color:#CCCCd7;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #004782;
text-align: center;
}
#container {
margin: auto;
width: 790px;
height: 600px;
background-color: white;
border: 1px solid #004782;
text-align: left;
}
#banner {
margin-bottom: 15px;
}
#navBar {
margin: auto;
width: 762px;
height: 32px;
}
#plugs {
margin: auto;
width: 755px;
text-align: right;
font-size: 10px;
}
#header {
margin: auto;
margin-top: 20px;
margin-bottom: 5px;
width: 725px;
font-size: 18px;
font-weight: bold;
}
#header img {
margin-bottom: 5px;
}
#main {
margin: auto;
width: 725px;
}
#mainLeft {
float: left;
width: 455px;
height: 280px;
}
#subheader {
font-weight: bold;
font-size: 11px;
}
#mainLeft ul {
margin-left: 10px;
}
#mainLeft ul li {
color: #000000;
font-size: 13px;
list-style-type: none;
margin: 3px 0px 3px 0px;
}
#mainRight {
float: right;
width: 270px;
height: 280px;
font-size: 10px;
color: #000000;
}
#mainRight img {
margin: 5px 0px 0px 70px;
}
#mainRight p {
margin: 8px 0px 0px 40px;
}
#support {
margin: auto;
width: 785px;
}
#supportBtns {
margin: 0px auto;
width: 400px;
}
#supportBtns img {
margin: 0px 3px 0px 3px;
}
#footer {
width: 755px;
margin: auto;
margin-top: 7px;
text-align: center;
font-size: 10px;
color: #000000;
}
a:link {
color: #004782;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #004782;
}
a:hover {
text-decoration: underline;
color: #3399FF;
}
a:active {
text-decoration: none;
color: #000000;
}
That's everything. Thanks.
|
|
|
11-17-2008, 11:56 PM
|
PM User |
#4
|
|
Regular Coder
Join Date: Mar 2008
Posts: 136
Thanks: 39
Thanked 1 Time in 1 Post
|
Put...
margin-left: auto;
margin-right: auto;
width: 400px;
instead.
|
|
|
11-18-2008, 03:54 AM
|
PM User |
#5
|
|
Regular Coder
Join Date: Feb 2007
Location: Canada
Posts: 924
Thanks: 10
Thanked 56 Times in 55 Posts
|
margin: 0 auto will work.
|
|
|
11-18-2008, 07:25 AM
|
PM User |
#6
|
|
Supreme Master coder!
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
|
You need a valid doctype at the top(to turn your document from quirks to standard) to work this in IE.
__________________
Quote:
|
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
|
Last edited by abduraooft; 11-18-2008 at 07:28 AM..
|
|
|
 |
Jump To Top of Thread
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +1. The time now is 03:04 PM.
|
Advertisement Log in to turn off these ads. |
|
|
|
|
|
|
|
|
|
|