課程
/前端開發
/HTML/CSS
/初識HTML(5)+CSS(3)-升級版
怎么讓盒子2個字位于這個正方形框的中間。
2016-07-06
源自:初識HTML(5)+CSS(3)-升級版 12-12
正在回答
用text-align:center
和line-height 來居中
慕粉3344523 提問者
#box1{
? ? text-align: center;
? ? width:100px;
? ? height:100px;
?? line-height:100px;
? ? border:1px solid red;
}
?是正確的
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>填充</title>
<style type="text/css">
? ? padding:10px;
</style>
</head>
<body>
<div id="box1">
? ? <pre> </pre>盒子1
</div>
</body>
</html>
box{padding:1px? 1px 1px? 40px;}
設置為會計元素,text-align=“center”
舉報
HTML(5)+CSS(3)基礎教程8小時帶領大家步步深入學習標簽用法和意義
2 回答盒子問題?。?!
7 回答css盒子問題
5 回答盒子大小問題。
7 回答盒子中內容不隨邊距而改變位置
1 回答關于在相對位置中加入盒子模型
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-07-06
用text-align:center
和line-height 來居中
2016-07-06
#box1{
? ? text-align: center;
? ? width:100px;
? ? height:100px;
?? line-height:100px;
? ? border:1px solid red;
}
?是正確的
2016-07-06
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>填充</title>
<style type="text/css">
#box1{
? ? text-align: center;
? ? width:100px;
? ? height:100px;
? ? padding:10px;
? ? border:1px solid red;
}
</style>
</head>
<body>
<div id="box1">
? ? <pre> </pre>盒子1
</div>
</body>
</html>
2016-07-06
box{padding:1px? 1px 1px? 40px;}
2016-07-06
設置為會計元素,text-align=“center”