【发布时间】:2020-04-21 22:21:50
【问题描述】:
我写了一个 html-css 演示,它有两个简单的 span 标签。我在 span 中放了一些内容,并使用相同的 css 代码。但是右侧 span 的内容超出了边框,左侧 span 的内容 在边界。
body {
background: #f5f5f5;
}
.container{
background-color: #5b6dcd;
color: #fff;
height: 200px;
display: flex;
justify-content: center;
align-items: center;
width:400px;
}
span{
border: 1px solid black;
margin: 5px;
padding: 5px;
text-align: center;
width: 100px;
}
<div class="container">
<span>
This is a box where you can change the width.
</span>
<span>
o1bn-43OCWVIP2fQNVPTQ1QNQrKc
</span>
</div>
我是css的初学者,有人可以解释一下发生了什么吗? 为什么是正确的出境?谢谢大家。
【问题讨论】: