<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<link rel="stylesheet" href="/css/reset.css" />
<link rel="stylesheet" href="/fa/css/all.css" />
<style>
header::before,
header::after {
content: "";
clear: both;
display: table;
}
header {
font-size: 12px;
color: #999;
line-height: 30px;
border-bottom: #ddd solid 1px;
background-color: #e3e4e5;
}
.inner-wrapper {
width: 1190px;
margin: 0 auto;
}
.location {
float: left;
padding:0 10px;
}
.location:hover{
background-color: white;
}
.pull-down-list{
height:433px;
width:302px;
background-color: white;
display: none;
border:solid rgb(204,204,204) 1px;
position:absolute;
box-shadow:0 0 2px rgba(0,0,0,.2)
}
.location:hover > .pull-down-list{
display:block;
}
ul {
float: right;
}
ul li {
float: left;
color: #999;
text-decoration: none;
}
a {
color: #999;
text-decoration: none;
}
a:hover {
color: red;
}
.fa-map-marker-alt {
color: red;
}
.cutting-line {
height: 10px;
width: 1px;
background-color: #ccc;
float: left;
margin: 10px 12px;
}
#last{
margin-right:50px;
}
</style>
</head>
<body>
<header>
<div class="inner-wrapper">
<div class="location">
<a href="javascript:;">
<i class="fas fa-map-marker-alt" style="font-size: 14px"></i>广东
</a>
<div class="pull-down-list"></div>
</div>
<ul>
<li><a href="javascript:;">你好,请登录</a></li>
<li class="cutting-line"></li>
<li>
<a href="javascript:;" style="color: red">免费注册</a>
<li class="cutting-line"></li>
</li>
<li>
<a href="javascript:;">我的订单</a>
<li class="cutting-line"></li>
</li>
<li>
<a href="javascript:;"
>我的京东<i class="fas fa-angle-down"></i>
</a>
<li class="cutting-line"></li>
</li>
<li>
<a href="javascript:;">京东会员</a>
<li class="cutting-line"></li>
</li>
<li>
<a href="javascript:;" style="color: red"
>政企采购<i class="fas fa-angle-down"></i>
</a>
</li>
<li class="cutting-line"></li>
<li>客户服务<i class="fas fa-angle-down"></i></li>
<li class="cutting-line"></li>
<li>网站导航<i class="fas fa-angle-down"></i></li>
<li class="cutting-line"></li>
<li>手机京东</li>
<li class="cutting-line"></li>
<li>
<a id="last" href="javascript:;">网站无障碍</a>
</li>
</ul>
</div>
</header>
</body>
</html>
为什么下拉菜单的内边距不会随着父元素内边距的增加而增加?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- 前端互助会 2022-01-17 09:08关注
内边距padding的含义:内容到border的区域
css有两大特性:继承性和层叠性
像一些盒子元素属性,定位的元素(浮动,绝对定位,固定定位)不能继承。
盒模型的属性
width:内容的宽度height: 内容的高度
padding:内边距,边框到内容的距离
border: 边框,就是指的盒子的宽度
margin:外边距,盒子边框到附近最近盒子的距离
** 所以padding也是无法继承的!** 你的问题就能想明白了,建议去学习一下上述知识点,谢谢!
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
- ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
- ¥16 mybatis的代理对象无法通过@Autowired装填
- ¥15 可见光定位matlab仿真
- ¥15 arduino 四自由度机械臂
- ¥15 wordpress 产品图片 GIF 没法显示
- ¥15 求三国群英传pl国战时间的修改方法
- ¥15 matlab代码代写,需写出详细代码,代价私
- ¥15 ROS系统搭建请教(跨境电商用途)
- ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。