0

I was using this code in my wordpress theme to align in center it didn't work, but if I align right or left it works:

  <table border="1" align="center">
  <tr>
    <td>
      <div style='width: 435px; height: 90px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/spring1_435x90_bg.jpg ); background-repeat: no-repeat; background-color: #607041;' >
       <div id='NetweatherContainer' style='height: 75px;' >
        <script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2ex.asp?partner=netweather&tStyle=normal&logo=1&zipcode=MEA|AE|AE005|DUBAI|&lang=eng&size=10&theme=spring1&metric=0&target=_self'></script>
     </div>
     <div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 15px; color: #FDEA11;' >
      <a style='color: #FDEA11' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=MEA|AE|AE005|DUBAI|&metric=1' >Forecast</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/maps-satellite.asp' >Maps</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&zipcode=MEA|AE|AE005|DUBAI|' >Radar</a>
     </div>
     <img style='float: right; padding-right: 5px;' src='http://vortex.accuweather.com/adc2004/common/images/misc/netweather_v2/adcwhite.png' /><div style='clear: both;' />
   </div>
 </div>
</td>

4

1 回答 1

0

如果您只想显示图像,只需将其容器居中而不是使用table元素:

.ad {
    display: block;
    margin:  0 auto;
}
.w435 {
    width:   435px;
}

然后给你div一个宽度(你已经有):

<div class="ad w435"><!-- content --></div>

小提琴:http: //jsfiddle.net/SQ9Qn/

于 2012-12-17T19:03:03.673 回答