CSS - 移动水平列表中的元素

标签 css

我在 table 右侧放置了一个 Google 广告。为此,我使用 CSS 并将表格和广告元素制作在水平列表中。代码如下。看起来不错,但我想将广告向下移动 25 像素,向右移动 25 像素。我该怎么做?

提前致谢

约翰

代码:

if($sum>0){

print "<ul class='horizontal_list'>";
print "<li>";

print "<table class=\"navbarb\">\n";
print "<tr>";
print "<td class='sitenameb'>".'<a type="amzn" class="links2b">'.$entry.'</a>'."</td>";
print "</tr>\n";
print "</table>\n";

//echo "<p class=\"topic3\">".'<a href="http://'.$entry.'" class="links3">'.$entry.'</a>'. "</p>\n";
echo "<p class=\"topic4\">". number_format($sum) . ' votes in total.'."</p>\n";

arsort($votes); //reverse sort preserving keys


//print "<td class='sitename'>".'<a href="http://'.$row['site'].'" class="links2">'.$row['site'].'</a>'."</td>";



foreach ($votes as $table => $votes) {
  print "<table class=\"navbar1\">\n";
  print "<tr>";
  print "<td class='sitename1'>". $table .'</a>' ."</td>";
  print "<td class='sitename2'>". number_format($votes) ."</td>";
  print "</tr>\n";
  print "</table>\n";

print "</li>";  

}

?> 

<li>
<div class="googlead3">
<script type="text/javascript"><!--
google_ad_
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</li>

一些CSS:

ul{
    margin: 0 auto;
}
ul.horizontal_list li{
    text-align: left;
    float: left;
    list-style: none;
    padding: 3px 10px 3px 10px;
    margin: 5px;`enter code here`
    border: 0px;
}   


    .googlead3
        {   
        float: right;
        margin-left:70px;
        margin-top:25px;
        margin-bottom:8px;
        padding:50px;
        }

最佳答案

最简单的是使广告position:relative(保留布局)并使其顶部:25px 和左侧:25px

关于CSS - 移动水平列表中的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1101691/

相关文章:

html - 动态容器

html - 伪元素 :after and :before not working 上的转换

html - 在 Bootstrap 中创建布局

css - 显示:table expands the height of the div.解决办法?

重叠式 div 的 CSS3 box-shadow

CSS 选择数字输入

jquery - 我希望文本在页面加载时同时执行某种 fadeIn 和 .slideDown

jquery - 如何使用 jquery mobile 从移动设备中选择图像并将其设置为背景图像?

css - 为什么 margin :auto is calculated different on chrome?

javascript - 在CSS中将CSS样式应用于表单项