我想在我的webapp项目使用侧边栏,对于我有我的sidebar.jsp类似以下内容:如何避免跨度大小影响父母的CSS
.social {
width: 100px;
height: 220px;
left: 0px;
}
.social li a {
display: block;
background: #222;
font: normal normal normal
16px/20px
'FontAwesome', 'Source Sans Pro', Helvetica, Arial, sans-serif;
color: #fff;
-webkit-font-smoothing: antialiased;;
text-decoration: none;
text-align: center;
transition: background .5s ease .300ms
}
.social li{
list-style: none;
}
.social li:first-child a:hover { background: #3b5998 }
.social li:nth-child(2) a:hover { background: #00acee }
.social li:nth-child(3) a:hover { background: #ea4c89 }
.social li:nth-child(4) a:hover { background: #dd4b39 }
.social li:first-child a { border-radius: 0 5px 0 0 }
.social li:last-child a { border-radius: 0 0 5px 0 }
.social li a span {
width: 250px;
float: left;
text-align: left;
background: #222;
color: #fff;
margin: -25px 74px;
padding: 8px;
transform-origin: 0;
visibility: hidden;
opacity: 0;
transform: rotateY(45deg);
border-radius: 5px;
transition: all .5s ease .300ms;
overflow: auto;
}
.social li span:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: -20px;
top: 7px;
border-left: 10px solid transparent;
border-right: 10px solid #222;
border-bottom: 10px solid transparent;
border-top: 10px solid transparent;
}
.social li a:hover span {
visibility: visible;
opacity: 1;
transform: rotateY(0)
}
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
<ul class='social'>
<li>
<a href="#"> First
<span>This is a big spawn that will break my app</span>
</a>
</li>
<li>
<a href="#"> Second
<span>This is a big spawn that will break my app This is a big spawn that will break my appThis is a big spawn that will break my appThis is a big spawn that will break my app</span>
</a>
</li>
<li>
<a href="#"> Third
<span>This is a big spawn that will break my app</span>
</a>
</li>
</ul>
它可以正常工作,但正如你所看到的,“第二个”物品有一个非常大的产卵物,所以这使得我的“第三”物品拥有如此多的空间。
有没有办法让spawn的大小不影响我的列表大小?我的意思是,我希望所有物品都有相同的尺寸,不管有多大的产卵。
谢谢!它为我工作。 – Manu
不客气,高兴地帮助:) – Pete