我有这个HTML:
<html>
<head>
<title>TEST</title>
<link rel="stylesheet" type="text/css" href="css/style1.css">
</head>
<body>
<div class="container">
<div class="left">
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
</div>
<div class="center">
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
</div>
<div class="right">
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
<a class="nolinea" href="test.html"><div class="grezzo"> Tunz-tunz-parapara-tunz</div></a><br>
</div>
</div>
</body>
</html>
这个CSS:
.grezzo{
-webkit-border-radius: 30px 30px 30px 30px;
-moz-border-radius: 30px 30px 30px 30px;
border-radius: 30px 30px 30px 30px;
width: 200px;
padding: 30px 30px 30px 30px;
background: grey;
text-align:center;
color: white;
box-shadow: 15px 15px 10px black;
transition: border-radius 2s, background 2s;
-moz-transition: -moz-border-radius 2s, background 2s;
-webkit-transition: -webkit-border-radius 2s, background 2s;
}
.grezzo:hover {
-webkit-border-radius: 40px 30px 40px 30px;
-moz-border-radius: 40px 30px 40px 30px;
border-radius: 40px 30px 40px 30px;
transition: border-radius 2s, background 2s;
-moz-transition: -moz-border-radius 2s, background 2s;
-webkit-transition: -webkit-border-radius 2s, background 2s;
background: darkblue;
}
.nolinea {
text-decoration: none;
}
.left{
float: left;
width: 500px;
}
.center{
margin:0 auto;
width: 100%;
}
.right{
float: right;
width: 500px;
}
.container{
width: 100%;
}
与jsfiddle类似。
我的问题是:我想让我的3个菜单左/中/右,就像一张桌子,但不使用它。我怎么能这样放置它们?
答案 0 :(得分:1)
您可以使用表格的CSS显示类型,也可以浮动所有三个菜单(.left,.center,.right) left ,并在其上设置合适的宽度。您正在混合像素宽度和百分比宽度,这可能会导致您遇到问题,但如果您执行以下操作:
.left, .center, .right {
float: left;
width: 33%;
}
你至少会看到你想要的开头。因为.grezzo是200px宽,所以如果你do it in jsfiddle有一些重叠。在不了解整体页面布局的情况下,很难确定这是否真的是一个很好的解决方案。
答案 1 :(得分:0)
给每个div提供同一个类,例如.block
然后为css添加.block { display: inline-block; }