css⽗级元素宽度根据后代元素最⼤固定宽度⾃适应
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
css布局左边固定右边自适应<title>css 实⽤技巧</title>
<style>
div{
width: min-content;
border: 1px dashed;
text-align: center;
}
span{
display: inline-block;
width: 100px;
height: 100px;
background: cyan;
}
</style>
</head>
<body>
<div>
<span>我充当图⽚</span>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Nihil, temporibus. Dignissimos pariatur aspernatur iusto omnis magni! Quaerat expedita ipsa nob </div>
</body>
</html>
效果展⽰:
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论