第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

看看我這個錯哪了, 為什么左和右放到中間就出問題,單獨放一個就沒事

<!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>

body{margin: 0;padding: 0;font-size: 20px;font-weight:bold}

div{text-align: center;line-height: 30px}

.top{height: 100px;background: blue}

.main{width: 800px;height: 300px;background: red;margin: 0 auto}

.left{width: 300px;height: 300px;background: yellow;float: left}

.right{width: 500px;height: 300px;background: #369;float: right}

.foot{height: 100px;background: #900;margin: 0 auto}

</style>

</head>

<body>

<div class="top">top</div>

<div class="main">main

<div class="left">left</div>

<div class="right">right</div>

</div>

<div class="foot">foot</div>

</div>

</body>

</html>


正在回答

5 回答

<div class="main"> main??這main是內(nèi)容了,單獨要成一個塊,覆蓋不了!

0 回復(fù) 有任何疑惑可以回復(fù)我~

<div class="main">main把最右main刪除就行了

0 回復(fù) 有任何疑惑可以回復(fù)我~

首先,我覺得你想得好像復(fù)雜了一些。,其實他要求完成什么就寫什么就行了。。你的main設(shè)置margin: 0 auto,他左右自動了,然后你的left又是左浮動,所以main就變成了left的右邊來了,

main我把他想作是一個背景,所以只設(shè)置和左右側(cè)相同的高度,然后寬度就隨便他變化了。你的top高100px,所以你可以直接給left設(shè)置絕對定位 position:absolute;top:100px;left:0px; ,然后left上面就緊貼top,并也在最左側(cè)了。然后給left設(shè)置一個寬度,例如你的300px,把right的位置用margin-left,這樣就可以將right和left的位置拉開,例如right設(shè)置margin-left:310px,這樣right距離左側(cè)邊緣就是310px,距離left就是10px。

0 回復(fù) 有任何疑惑可以回復(fù)我~

倒數(shù)第三行,多了一個</div>吧。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
如何用CSS進(jìn)行網(wǎng)頁布局
  • 參與學(xué)習(xí)       209570    人
  • 解答問題       1197    個

用最簡潔的案例教你布局的那些知識,這是前端工程師基本技能

進(jìn)入課程

看看我這個錯哪了, 為什么左和右放到中間就出問題,單獨放一個就沒事

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號