将样式化的 div 并排放置
putting styled divs next to each other
我现在正在制作一个网站,但我希望其中有 4 个彼此相邻的圆圈,
它们之间有大约 50px 的边距。我可以在正确的位置得到一个圆圈,但是当我想做更多的时候它不会显示圆圈。
我的 css 是:
.webdesign-circle {
height: 200px;
width: 200px;
background: #0EB1E8;
border-radius: 50%;
margin: 50px 0px 0px 70px;
float: left;
}
.onderhoud-cirlce {
height: 200px;
width: 200px;
background: #0EB1E8;
border-radius: 50%;
margin: 70px 0px 0px 150px;
float: left;
}
提前致谢
这是你的意思吗?你可以使用 margin-left
http://jsfiddle.net/wzv4gmft/7/
也许你的意思是这样的
HTML:
<div class="circle one"></div>
<div class="circle two"></div>
<div class="circle three"></div>
<div class="circle four"></div>
CSS
.circle {
height: 200px;
width: 200px;
border-radius: 100%;
display: inline-block;
margin-left: 50px;
}
.one {
background: #e6e6e6
}
.two {
background: #e6e6e6
}
.three {
background: #e6e6e6
}
.four {
background: #e6e6e6
}
可以通过不同的div(一二三四五)改变每个圆圈的背景颜色
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.wrapper {
width: 600px;
margin: 0 auto;
}
.circle {
height: 100px;
width: 100px;
border-radius: 100%;
margin: 25px;
background: #213;
display: inline-block;
}
.circle:first-child {
margin-left: 0px;
}
.circle:last-child: {
margin-right: 0px;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="circle one"></div>
<div class="circle two"></div>
<div class="circle three"></div>
<div class="circle four"></div>
</div>
</body>
</html>
我的尝试:)
编辑:你打错了,我把它复制到我的例子里了哈哈.onderhoud-cirlce
Fiddle : http://jsfiddle.net/14f0vunh/
HTML
<div class="webdesign-circle"></div>
<div class="onderhoud-circle"></div>
<div class="test-circle"></div>
CSS
[class*=circle]
{
display: inline-block;
height: 200px;
width: 200px;
border-radius: 50%;
}
[class*=circle] + [class*=circle]
{
margin-left: 50px;
}
.webdesign-circle {
background-color: blue;
}
.onderhoud-circle {
background-color: red;
}
.test-circle {
background-color: green;
}
我现在正在制作一个网站,但我希望其中有 4 个彼此相邻的圆圈, 它们之间有大约 50px 的边距。我可以在正确的位置得到一个圆圈,但是当我想做更多的时候它不会显示圆圈。
我的 css 是:
.webdesign-circle {
height: 200px;
width: 200px;
background: #0EB1E8;
border-radius: 50%;
margin: 50px 0px 0px 70px;
float: left;
}
.onderhoud-cirlce {
height: 200px;
width: 200px;
background: #0EB1E8;
border-radius: 50%;
margin: 70px 0px 0px 150px;
float: left;
}
提前致谢
这是你的意思吗?你可以使用 margin-left
http://jsfiddle.net/wzv4gmft/7/
也许你的意思是这样的
HTML:
<div class="circle one"></div>
<div class="circle two"></div>
<div class="circle three"></div>
<div class="circle four"></div>
CSS
.circle {
height: 200px;
width: 200px;
border-radius: 100%;
display: inline-block;
margin-left: 50px;
}
.one {
background: #e6e6e6
}
.two {
background: #e6e6e6
}
.three {
background: #e6e6e6
}
.four {
background: #e6e6e6
}
可以通过不同的div(一二三四五)改变每个圆圈的背景颜色
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.wrapper {
width: 600px;
margin: 0 auto;
}
.circle {
height: 100px;
width: 100px;
border-radius: 100%;
margin: 25px;
background: #213;
display: inline-block;
}
.circle:first-child {
margin-left: 0px;
}
.circle:last-child: {
margin-right: 0px;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="circle one"></div>
<div class="circle two"></div>
<div class="circle three"></div>
<div class="circle four"></div>
</div>
</body>
</html>
我的尝试:)
编辑:你打错了,我把它复制到我的例子里了哈哈.onderhoud-cirlce
Fiddle : http://jsfiddle.net/14f0vunh/
HTML
<div class="webdesign-circle"></div>
<div class="onderhoud-circle"></div>
<div class="test-circle"></div>
CSS
[class*=circle]
{
display: inline-block;
height: 200px;
width: 200px;
border-radius: 50%;
}
[class*=circle] + [class*=circle]
{
margin-left: 50px;
}
.webdesign-circle {
background-color: blue;
}
.onderhoud-circle {
background-color: red;
}
.test-circle {
background-color: green;
}