課程
/前端開發
/HTML/CSS
/網頁布局基礎
怎么把字體都搞得和樣本一樣?
2015-12-29
源自:網頁布局基礎 3-5
正在回答
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><style type="text/css">* {??? margin:0;?? ?padding:0;}#wrap {?? ?background:#00C;?? ?margin:0 auto;?? ?width:960px;}#header {?? ?background:#FF3300;?? ?width:100%;}#mainbody {?? ?background:#FC0;??? width:100%;??? overflow:hidden;}.left {?? ?width:800px;?? ?height:200px;?? ?background:#000;??? float:left;??? font-size:20px;??? color:#fff;??? text-align:center;??? line-height:200px;}.right {??? width:140px;??? height:500px;??? background:#690;??? float:right;??? font-size:20px;??? color:#fff;??? text-align:center;??? line-height:500px;}#mainbody p{??? font-size:20px;??? color:#fff;??? text-align:center;??? line-height:200px;}#footer {?? ?background:#639;?? ?width:100%;}</style></head><body><div id="wrap">? <div id="header">頭部</div>? <div id="mainbody">??? <div class="left">left</div>??? <div class="right">right</div>??? <p>mainbody</p>? </div>? <div id="footer">版權部分</div></div></body></html>
寧靜致遠_擇善固執 提問者
應該是在設置mainbody的屬性為{
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?color:white;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? font-family:"Microsoft Yahei";
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? font-size:??;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? text-align:center;}
然后在left和right里分別設置?text-align:center以及line-height和行高一致,這樣就能實現left和right里文字的水平垂直居中了,但是mainbody里我小白沒找到方法垂直居中。。???/p>
去織夢中自己調
舉報
讓你精通CSS中三大定位機制,徹底掌握網頁布局的相關知識
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-12-29
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
* {
??? margin:0;
?? ?padding:0;
}
#wrap {
?? ?background:#00C;
?? ?margin:0 auto;
?? ?width:960px;
}
#header {
?? ?background:#FF3300;
?? ?width:100%;
}
#mainbody {
?? ?background:#FC0;
??? width:100%;
??? overflow:hidden;
}
.left {
?? ?width:800px;
?? ?height:200px;
?? ?background:#000;
??? float:left;
??? font-size:20px;
??? color:#fff;
??? text-align:center;
??? line-height:200px;
}
.right {
??? width:140px;
??? height:500px;
??? background:#690;
??? float:right;
??? font-size:20px;
??? color:#fff;
??? text-align:center;
??? line-height:500px;
}
#mainbody p{
??? font-size:20px;
??? color:#fff;
??? text-align:center;
??? line-height:200px;
}
#footer {
?? ?background:#639;
?? ?width:100%;
}
</style>
</head>
<body>
<div id="wrap">
? <div id="header">頭部</div>
? <div id="mainbody">
??? <div class="left">left</div>
??? <div class="right">right</div>
??? <p>mainbody</p>
? </div>
? <div id="footer">版權部分</div>
</div>
</body>
</html>
2016-03-18
應該是在設置mainbody的屬性為{
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?color:white;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? font-family:"Microsoft Yahei";
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? font-size:??;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? text-align:center;}
然后在left和right里分別設置?text-align:center以及line-height和行高一致,這樣就能實現left和right里文字的水平垂直居中了,但是mainbody里我小白沒找到方法垂直居中。。???/p>
2015-12-29
去織夢中自己調