css - 这个a标签为什么不能充满这个div?
本文介绍了css - 这个a标签为什么不能充满这个div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
鼠标放到a标签的左边不能选中a标签 放到右边可以 我设置了宽度100%为什么还不行? 怎样才能让它的宽度充满这个div呢?
<div style="width: 20%;height: 200px;background-color: #DDDDEF">
<ul style="width: 100%;">
<li style="width: 100%;display: inline-block;"><a href="" style="display: inline-block;width: 100%;">aaa</a></li>
</ul>
</div>
解决方案
因为ul
标签有默认的40px的padding-left
,在样式中去除就行
一般在样式表最开始会去除所有默认元素的样式,最简单粗暴的方式如下
*{
margin: 0;
padding: 0;
list-style: none;
border: none;
text-decoration: none;
}
这篇关于css - 这个a标签为什么不能充满这个div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文