html - 左右 div css

标签 html css

我试图在一行中制作 2 个 div,但这样做有问题。我真的不知道如何解决这个问题。

<div class="wrapper">

<span class="left">
<ul>
<li><a href="#">ipad</a></li>
<li><a href="#">iphone</a></li>
<li><a href="#">mac</a></li>
<li><a href="#">ipod</a></li>
<li><a href="#">apple tv</a></li>
</ul>
</span>

<span class="right">
right content
</span>

</div>

css 是:

.wrapper{position:absolute;font-size:16px;height:15%;width:100%;}
.left{float:left;left:0;width:60%;}
.right{float:right;right:0;width:300px;}

ul {
list-style: none outside none;
}

li {
background-image: url(arrow.png);
background-repeat: no-repeat;
background-position: -1 .4em;
display: inline;
margin: 20px;
}

在这里你可以看到修改版本:http://jsfiddle.net/5wquccee/

最佳答案

.wrapper{position:absolute;font-size:16px;height:15%;width:100%; }
.left{float:left;left:0;width:60%;}
.right{float:right;right:0;width:300px;}

ul {
list-style: none outside none;
    margin: 0px auto;
}

li {
background-image: url(arrow.png);
background-repeat: no-repeat;
background-position: -1 .4em;
display: inline;
margin: 0px 20px;
}
div{overflow: visible;}
<div class="wrapper">

<span class="left">
<ul>
<li><a href="#">ipad</a></li>
<li><a href="#">iphone</a></li>
<li><a href="#">mac</a></li>
<li><a href="#">ipod</a></li>
<li><a href="#">apple tv</a></li>
</ul>
</span>

<span class="right">
right content
</span>

</div>

尝试使用这个 css

.wrapper{position:absolute;font-size:16px;height:15%;width:100%; }
.left{float:left;left:0;width:60%;}
.right{float:right;right:0;width:300px;}

ul {
list-style: none outside none;
    margin: 0px auto;
}

li {
background-image: url(arrow.png);
background-repeat: no-repeat;
background-position: -1 .4em;
display: inline;
margin: 0px 20px;
}
div{overflow: visible;}

关于html - 左右 div css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27756838/

相关文章:

html - <span> 元素拒绝在 flexbox 中内联

javascript - 我们如何在通过 Controller 附加到 html 页面的 html 中使用 angularjs 作用域变量?

html - css 中大于选择器的三倍是什么?

java - 如何将背景图像和 HTML 内容合并为一个可下载图像

javascript - 如何在 Div Wrapper 中实现圆形动画

html - 谷歌字体在 IE11 中不工作

HTML/CSS : multiple successive full screen images

javascript - 如何设计带有内部 float 的 div 以水平扩展以允许所有内部 float div 适合?

php - WordPress <?php body_class(); ?> 问题

html - 照片幻灯片