一共有两层嵌套,我用border显示外边框,如果把float加在不同类里会导致最里面的行高能否继承父类的行高和li的长度不同,这是为啥有不同呢?
html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Documenttitle>
<style>
.one{
color: red;
background-color: aqua;
line-height: 50px;
}
.two{
/* float: left;*/
color: orange;
background-color: rgb(255, 0, 136);
}
.three{
float: left;
border: 2px solid black;
font-size: 20ps;
}
style>
head>
<body>
<div class="one">
<li class="two">
<span class="three">
fff
span>
li>
div>
body>
html>
如果加在two里
如果加在three里
这应该是在于块级元素和内联元素的区别
css加一个*{margin:0;padding:0}