2 Replies - 3848 Views - Last Post: 07 March 2009 - 12:37 PM

#1 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

Cant Align Div Center

Posted 07 March 2009 - 01:36 AM

Heres my code, basically that only div wont align center not with the align="center" is my code missing something?

<?php defined( '_JEXEC' ) or die( 'Restricted access' );?>
<!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" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >

<head>
	<jdoc:include type="head" />
	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/ils_2009/css/template.css" type="text/css" />
	<link rel="shortcut icon" href="<?php echo $this->baseurl ?>/templates/ils_2009/favicon.ico" />
</head>

<body style="background-image:url(<?php echo $this->baseurl ?>/templates/ils_2009/images/bg.jpg); background-repeat: repeat;" align="center">

<div align="center" style="width:800px;height:100%;background-image:url(<?php echo $this->baseurl ?>/templates/ils_2009/images/bg_image_1.jpg); background-repeat: repeat-y;">
	
</div>
</body>

</html>


Thank you,
Musya

Is This A Good Question/Topic? 0
  • +

Replies To: Cant Align Div Center

#2 Kirth  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 157
  • Joined: 09-July 08

Re: Cant Align Div Center

Posted 07 March 2009 - 09:46 AM

I believe the div align=center system doesn't work. Try this:

<div id="bodywrapper">
       <div id="content">
        You touched my tralala?
        </div>
</div>



#bodywrapper
{
      text-align : center; // Internet Exploder.
      margin: auto; // Opera, Safari, Gecko-based browsers (ie: firefox, flock, blackbird).
}

#content
{
      text-align: left; // Make sure the text doesn't get aligned in the center here as well.
      width: 750px;  // Edit the width to fit your theme.
}



I believe that should do the trick. Good luck!
Was This Post Helpful? 0
  • +
  • -

#3 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

Re: Cant Align Div Center

Posted 07 March 2009 - 12:37 PM

that did the trick but weird thing is though is that after i posted this, I added another div above that one and used align="center" and it worked fine, but not for this div..... ? who knows.....


Also, if I add a margin-top or padding-top to the body div it doesn't do it. which I'm not sure why but maybe someone here does?

This post has been edited by musya: 07 March 2009 - 12:57 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1