Jump to content

centering a div


mindapolis
Go to solution Solved by mindapolis,

Recommended Posts

Hi, I know that this is a simple question but I can't get the photos div to center.  I thought if you set the left and right margins to auto that would center it, but for some reason it 's not. 

<?php
require_once('Ftest.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
body {
	width:100%;
	margin:0;
}
#header {
		background-color: #735435;
		
} 
#logo {
	float: left;
}
#lonPic{
	float: right;
	padding-botto:10%;
	padding-right:2%; 
}
#headerAdjust {
	clear:both;
}
#photos {
	width: 100%; 
	margin-left:auto; 
	margin-right:auto; 
}
	</style>
</head>

<body>
<div id="header"><!-- html5 tag<header>-->
<div id="logo">
  <img src="assets/logo.jpg" width="439" height="135" />
</div>

<div  id="lonPic">
<img src="assets/jenn2.jpg" width="100" height="144" /></div>
<div id="headerAdjust"></div>
<?php photos(); ?> 
</div><!--</header>-->
</body>
</html>

.

<?php
Function photos() {
echo" <div id='photos'>";
    echo"<img src='assets/couple.jpg' width='80' height='71' alt='couple'>"; 	 
	echo "<!--picture came from  http:  //www.google.com/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1280&bih=860&oq=family+&gs_l=img.3..0l10.60419.60720.0.65568.7.4.0.0.0.0.144.316.3j1.4.0....0...1ac..26.img..4.3.172.EfFzboI_D4w&q=family#hl=en&q=couple+&tbm=isch&imgdii=_ -->";
    echo"<img src='assets/forgiveness.jpg' width='100' height='67' alt='forgive '><!--this picture came from https://www.google.com/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1280&bih=860&q=forgiveness&oq=forg&gs_l=img.1.0.0l10.432338.531398.0.538817.11.8.3.0.0.0.174.1071.0j8.8.0....0...1ac.1.26.img..0.11.1084.JlerqVJLo-4#facrc=_&imgdii=_&imgrc=ebKrSk37ZGr6aM%3A%3BG0_SPpfIYVo-4M%3Bhttp%253A%252F%252Fpaulocoelhoblog.com%252Fwp-content%252Fuploads%252F2012%252F06%252Fforgiveness.jpg%3Bhttp%253A%252F%252Fpaulocoelhoblog.com%252F2012%252F06%252F06%252Fforgiveness%252F%3B432%3B288 -->";
      echo"<img src='assets/men.jpg' width='100' height='64' alt='men'><!-- image can be found on https://www.google.com/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1280&bih=860&q=men%27s+group&oq=men%27s+gr&gs_l=img.3.1.0l4j0i10j0l2j0i10j0l2.10469.34358.0.43322.11.9.1.1.2.1.181.1108.1j8.9.0....0...1ac.1.26.img..2.9.817.y7_Q2DlUg2g#facrc=_&imgdii=_&imgrc=pbDQwD5VV-4dyM%3A%3BYfceYvmaZLzjsM%3Bhttp%253A%252F%252Fwww.heartofthecitychurch.org%252Fimg%252Fhow_we_connect_men.jpg%3Bhttp%253A%252F%252Fwww.heartofthecitychurch.org%252Fhow_we_connect.php%3B428%3B273 -->";
      echo"<img src='assets/family.jpg' width='100' height='67' alt='family '> <!--image came from https://www.google.com/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1280&bih=860&oq=family+&gs_l=img.3..0l10.60419.60720.0.65568.7.4.0.0.0.0.144.316.3j1.4.0....0...1ac..26.img..4.3.172.EfFzboI_D4w&q=family#facrc=_&imgdii=_&imgrc=OkMHJw64_lvMhM%3A%3Bsn0JIiafz_FTMM%3Bhttp%253A%252F%252Fwww.imgion.com%252Fimages%252F01%252FComplete-Familiy-.jpg%3Bhttp%253A%252F%252Fwww.imgion.com%252Fimg%252Ffamily%252Fpage%252F16%252F%3B1600%3B1066-->";
       echo"</div>";
	
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.