html 文字少则居中多则居左

时间:2023-03-08 21:18:45
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="index.css">
<style>
.father{
width: 100px;
height: 100px;
text-align: center;
background: red;
}
.son{
display: inline-block;
text-align: left;
background: #666666;
} </style>
</head>
<body> <div class="father">
<div class="son">
双方姥产出看看
</div>
</div> </body>
</html>

<!DOCTYPE html><html><head><link rel="stylesheet" href="index.css"><style> .father{width: 100px;height: 100px;text-align: center;background: red;}.son{display: inline-block;text-align: left;background: #666666;}
</style></head><body>
<div class="father"><div class="son">双方姥产出看看</div></div>
</body></html>