lucy Posted August 18, 2009 Share Posted August 18, 2009 can centre the theme fine in Firefox, but not so great in IE. All of the DIVs fill the page horizontally, and dont centre. Below is all my code: header.php: <html> <head> <title></title> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"> </head> <body> <div id="header"> <h1><img src="../../../../templogo.gif" width="497" height="297" alt="Logo"></h1> </div> index.php: <?php get_header(); ?> <div id="main"> <div id="content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <h6>Posted on <?php the_time('F j, Y') ?></h6> <p><?php the_content(__('(more...)')); ?></p> <hr> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> </div> <?php get_sidebar(); ?> </div> <div id="both"></div> <?php get_footer(); ?> sidebar.php: <div id="sidebar"> <div class="title">About</div> <p>This is a demo</p> </div> footer.php: <div id="footer"> <h1>FOOTER</h1> </div> </div> </body> </html> style.css: * { margin: 0; } body { background-color:#9b9b9b; width:982px; margin-left:auto; margin-right:auto; display: block; } #header { border: 2px #00ff00 solid; padding:0px; } #header h1 {padding-top:20px; margin:0px;} #content { border: 2px #ff0000 solid; float: left; margin-top:10px; padding:0 10px 10px 10px; } #content h6 {margin-bottom:10px;} #content p { padding-left:30px;} #sidebar { margin-top:10px; padding: 5px; width: 22%; border: 2px #ffff00 solid; float: right; } #both { clear: both; } #footer { margin-top:10px; border: 2px #0000ff solid; } .title { font-size: 11pt; font-family: verdana; font-weight: bold; } Ive set the width of the body to be 982px and set margin-left and margin-right of the body to auto. As i said before, it works fine in FF but not IE! Can someone please help. Thanks Lucy Quote Link to comment https://forums.phpfreaks.com/topic/170848-solved-centering-a-wordpress-theme-in-ie/ Share on other sites More sharing options...
wildteen88 Posted August 18, 2009 Share Posted August 18, 2009 The only issue I see is you you're not setting a valid DOCTYPE. You must always declare a valid doctype. Quote Link to comment https://forums.phpfreaks.com/topic/170848-solved-centering-a-wordpress-theme-in-ie/#findComment-901150 Share on other sites More sharing options...
lucy Posted August 18, 2009 Author Share Posted August 18, 2009 a valid doctype on EVERY .php file or only on the first php file, which includes all of the other .php files? Quote Link to comment https://forums.phpfreaks.com/topic/170848-solved-centering-a-wordpress-theme-in-ie/#findComment-901400 Share on other sites More sharing options...
wildteen88 Posted August 19, 2009 Share Posted August 19, 2009 No only in the header.php file before the opening <html> tag. Example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> Quote Link to comment https://forums.phpfreaks.com/topic/170848-solved-centering-a-wordpress-theme-in-ie/#findComment-901978 Share on other sites More sharing options...
lucy Posted August 21, 2009 Author Share Posted August 21, 2009 got it sorted, thanks Quote Link to comment https://forums.phpfreaks.com/topic/170848-solved-centering-a-wordpress-theme-in-ie/#findComment-903426 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.