亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

如何用CSS進行網頁布局

江老實 Web前端工程師
難度初級
時長22分
學習人數
綜合評分9.60
1991人評價 查看評價
9.8 內容實用
9.6 簡潔易懂
9.4 邏輯清晰
.top{background:#ccc;}
.main{background:red; height:600px;}
.left{ width:30%;height:100%; float:left; background:blue;}
.right{width:60%;height:100%; float:right;background:black;}
.foot{background:orange;}
測試ok的

.main{height:400px;background:red;position:relative;}
.left{ width:200px;height:400px;background:blue; position:absolute;left:0;top:0;}
.right{height:400px;background:lightgreen;margin-left:210px;}

最新回答 / 慕神0129940
1.應該是margin:0 ? ? ? 2.漏了</style> ? ? ? ?3</div> 應該緊接著<div class="lee">后面
剛剛寫的那個有問題,感覺css很難學啊 .top{background:#ccc;height:50px;} .main{height:500px;background:#ff0000;position:relative;} .left{height:500px;width:200px;background:#0000FF;position:absolute;left:0px;top:0px;} .right{height:500px;margin-left:210px;background:#66CDAA;} .foot{background:#FF7256;height:50px;}
分享一下

.top{background:#ccc;height:50px;}
.main{height:500px;background:#ff0000;position:relative;}
.left{height:500px;width:200px;background:#0000FF;float:left;}
.right{height:500px;position:absolute;left:210px;background:#66CDAA;width:100%;}
.foot{background:#FF7256;height:50px;}
body{ margin:0; padding:0; font-size:30px; background-color:red}
.top{height:100px; background:#ccc}
.left{ width:200px; height:500px; background:blue;position:absolute;top:100px;left: 0; }
.right{ margin-left:210px;height:500px; background:#9C9;}
.foot{ height:100px;background:#F63;clear:both;}
head{ width:100%; height:100px; background:#ccc}
.main{ height:600px; background:#FCC;margin:0 auto;}
.footer{ height:50px; background:#9CF;margin:0 auto;}
非常感謝!
只貼關鍵部分代碼吧:
.main{background-color:red;height:600px;}
.left{width:200px;height:600px;background-color:blue;float:left;}
.right{height:600px;background-color:green;float:right;width:calc(100% - 210px);}
.foot{clear:both;heigth:100px;background-color:orange;}

最新回答 / 陳冠瑋
就把righe 標簽 寫在前面呀 ~ 他本來的代碼 就是把 right 寫在前面的! 你只需要絕對定位 left ?,然后right 用margin-left:210px;就好了

最新回答 / 慕用8339455
注意float與position的區別:float僅僅只是將元素浮動到左邊或者右邊,沒有任何數值要求但是當有數值要求時,用絕對定位position更加精確

最贊回答 / qq_落城南_0
就是中間字體太大,裝不下,你可以把字體調小,我用的3px,然后你看效果,就可以了。高度我用的300px, 然后你全屏看效果,應該是了,我都行。
.main 里面的 margin 后面少了分號既然居中了,沒有出錯?

最贊回答 / 行云LS
因為是先加載right后加載left,right沒有浮動,因此要占一整行,left就被擠下去了。要達到效果可以把left變為絕對定位。代碼如下<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>混合布局編程挑戰</title><style typ...
課程須知
1.你需要掌握html+css樣式基礎知識 2.有一定的前端實際開發經驗
老師告訴你能學到什么?
1.掌握網頁布局的相關知識 2.能對不同的網頁進行布局結構劃分 3.掌握固定寬度和自適應寬度的實現方法

微信掃碼,參與3人拼團

微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網的支持!

本次提問將花費2個積分

你的積分不足,無法發表

為什么扣積分?

本次提問將花費2個積分

繼續發表請點擊 "確定"

為什么扣積分?

舉報

0/150
提交
取消