2012-07-29 21 views
2

在我的網站http://goo.gl/BcJtC「關於我們」的部分我想讓行星圖片在DIV中間水平對齊。 我試過text-align:center;但它不起作用。任何想法?由於問題在DIV中水平對齊圖像

HTML

<div class="section" id="plan-activite"> 
<div id="activity-container"> 
<div id="activity-left"><span class="activity-title">About Us</span><br /><img src="images/planet-water.jpg" class="activity-planet" alt="Picture" /></div> 
<div id="activity-right"><p><span class="activity-conclusion">XYZ, naturlig mineralvann, ren natur</span></p><br /><p>XXZ AS was founded May 2011sdqsd.</p><br/> 
</div> 
</div> 
</div><!--END page3--> 

CSS

#activity-container 
{ 
    width:90%; 
    background-color:#FFFFFF; 
    Height:400px; 
    margin-left: auto; 
    margin-right: auto; 
    opacity:0.95; 
    filter:alpha(opacity=95); /* For IE8 and earlier */ 
    border: 1px solid #efefef; 
    background: #fff; 
    -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset; 
    -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset; 
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset; 
} 

#activity-left { 
color:#000; 
margin: 0 auto; 
border-style:solid; 
border-right-color:#666; 
padding:15px; 
width: 30%; 
float: left; 
position: relative; 
} 

#activity-right { 
font:12px 'Open Sans', "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
font-weight:400; 
margin: O auto; 
padding:15px; 
color:#000; 
width: 60%; 
float: left; 
position: relative; 
text-align:justify; 
-moz-column-count: 1; 
-moz-column-gap: 1.5em; 
-moz-column-rule: 1px solid #c4c8cc; 
-webkit-column-count: 1; 
-webkit-column-gap: 1.5em; 
-webkit-column-rule: 1px solid #c4c8cc; 
} 


.activity-planet 
{ 
    text-align:center; 
    margin-top:20px; 
    margin-left:20px; 
    } 

回答

4

如果設置display: blockmargin: 0 auto;img {

+0

完美它將工作!謝謝 – Greg 2012-07-29 17:42:17