html代码
<section class="favorite-list clearfix">
<div class="favorite-count">
<div class="favs">
40
<small>收藏</small>
</div>
</div>
<div class="favorite-content ">
<p class="author"><a href="#">学想有成</a> <span>2016-4-7</span></p>
<h2 class="favorite-article-title">
<a href="#">dsfasdfffsdaaafasdfsdafasdfffdsfsdfsdafsfasdfsdf</a>
</h2>
</div>
</section>
css代码
.favorite-box{
padding:15px 20px 0;
}
.favorite-list{
padding: 10px 0;
border-bottom: 1px solid #eee;
}
.favorite-count{
width:45px;
height:43px;
float: left;
text-align:center;
margin-right:-45px;
}
.favs{
padding-top: 3px;
width: 45px;
height: 40px;
border-radius: 1px;
background: #f0f5f3;
color: #017e66;
font-size:16px;
line-height: 1.2;
}
.favorite-count small{
display:block;
font-size:12px;
}
.favorite-content{
margin-left:55px;
}
.favorite-article-title{
font-weight: 500;
line-height:16px;
}
.favorite-article-title a{
color: #333;
font-size:14px;
}
为什么p标签控制器不了其子a标签的内容的
而且h2标签下的a标签英文内容会超出容器的范围,不换行
这是怎么回事
第一个问题:css选择器是有优先级的,控制不了的原因肯定是有优先级更高的样式在控制,你需要检查一下css(一般带调试工具的浏览器都可以看到,建议使用chrome)。
第二个问题:换行请参考css3属性http://www.w3school.com.cn/cssref/pr_wor...