I write a html-css demo that has two simple span tag. I put some content in the span,and use the same css code.But the content of the right span out of the border,the content of the left span in the border.
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>
I'm a beginner for css,can someone please explain what happends? Why the right one out of border?Thank you for all.