<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Document</title><style>*{ margin:0; padding: 0;}header{background: #000;height: 3em;}header >div{width:50%;margin:auto; }header >div >img{float: left; display: block;margin-top: 0.4em;}header>div >a{float:right;padding: 1em;color: #fff;text-decoration: none;}/*banner*/.banner{display: block;}.banner img{z-index: 1;width: 100%;height: 31em;display: block;}.banner h1{ position: absolute; top: 50%; left: 50%;color: #fff;}.banner p{ position: absolute; top: 55%; left: 50%;color: #fff; ? ?padding-top: 1em;}</style></head><body><header>?<div>? ? ? <img src="img/logo.jpg" alt="">? ? ? <a href="">1</a>? ? ? <a href="">2</a>? ? ? <a href="">3</a>? ? ? <a href="">4</a>? ? ? </div></header><section>? ? ? ? <img src="img/banner.jpg" alt="">? ? ? ? <h1>內(nèi)容</h1>? ? ? ? <p>neirong</p>? ?</section></body></html>
2 回答

學(xué)習(xí)js
TA貢獻85條經(jīng)驗 獲得超55個贊
沒看到空白,你外部引入的css是啥?要是你那有空白的話,可能是header里面的浮動造成的吧,在header和section中間加一個空div,設(shè)置清除浮動試試
- 2 回答
- 0 關(guān)注
- 3078 瀏覽
添加回答
舉報
0/150
提交
取消