課程
/前端開發(fā)
/HTML/CSS
/初識HTML(5)+CSS(3)-升級版
怎么讓div1居中呢?margin:0 autor;不行啊
2016-04-17
源自:初識HTML(5)+CSS(3)-升級版 13-8
正在回答
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>relative樣式</title>
<style type="text/css">
#div1{
? ? width:200px;
? ? height:200px;
? ? line-height:200px;
????border:2px red solid;
? ? margin:20px auto;
????background:#ccc;
? ? //position:fixed;
? ? //bottom:0;
? ? //right:0;
}
</style>
</head>
<body>
<div id="div1"></div>
<p>文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本。</p>
? ?
</body>
</html>
div1{ text-align:center;}
echojson 提問者
舉報
HTML(5)+CSS(3)基礎(chǔ)教程8小時帶領(lǐng)大家步步深入學(xué)習(xí)標(biāo)簽用法和意義
2 回答層模型--固定定位
5 回答層模型的固定定位
5 回答層模型--固定模型
4 回答層模型—絕對定位
2 回答層模型-絕對定位
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-04-17
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>relative樣式</title>
<style type="text/css">
#div1{
? ? width:200px;
? ? height:200px;
? ? line-height:200px;
????border:2px red solid;
? ? margin:20px auto;
????background:#ccc;
? ? //position:fixed;
? ? //bottom:0;
? ? //right:0;
}
</style>
</head>
<body>
<div id="div1"></div>
<p>文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本。</p>
? ?
</body>
</html>
2016-04-17
div1{ text-align:center;}