As mentioned above, the width of the item expands to match the flec container, but
How do I adjust this to the "item" content width?
[html]
<!DOCTYPE html>
<html>
<head>
<metacharset="utf-8">
<title>Practice</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<p class="item">item</p>
<p class="item">item</p>
<p class="item">item</p>
</div>
</body>
</html>
[css]
@charset "UTF-8";
*{
margin:0;
padding:0;
text-align:center;
}
/* I want to line it up vertically to match the width inside*/
US>.container{
display:flex;
background:skyblue;
justify-content:space-between;
flex-direction:column;
}
.item{
background:tomato;
flex:01 auto;
}
align-items:center
It's done!
In .item
margin:0 auto;
How about adding
© 2024 OneMinuteCode. All rights reserved.