Div没有进入正确的位置

时间:2014-03-01 15:38:04

标签: html css

我遇到了div的一些问题,这不是正确的位置,看看:
http://prntscr.com/2wwajd

HTML
http://pastebin.com/JecDqRJy

CSS
http://pastebin.com/Svszs3xU

1 个答案:

答案 0 :(得分:0)

嗯,那不是那么奇怪。左边的菜单没有包装,也没有宽度。此外,它不会浮动

我为菜单链接添加了一个包装器,在这里: http://jsfiddle.net/TT2Qa/

HTML

 <div class="menu">
    <a href="home.html"><div id="content-box1">
    <img src="data/home.gif" id="home" style="float:right;"> <div style="">Home</div>
    </div></a>
    <br><br>
    <a href="anjos.html"><div id="content-box1">
    <img src="data/interrogacao.gif" height="32" width="32"
    id="anjos" style="float:right;"> <div style="">Anjos da Natureza</div>
    </div></a>
    <br><br>
    <a href="acessoria.html"><div id="content-box1">
    <img src="data/caneta.gif" height="32" width="32"
    id="acessoria" style="float:right;"> <div style="">Acessoria Ambiental</div>
    </div></a>
    <br><br>
    <a href="projetos.html"><div id="content-box1">
    <img src="data/papel.gif" height="32" width="32"
    id="projetos" style="float:right;"> <div style="">Projetos</div>
    </div></a>
    <br><br>
    <a href="doacao.html"><div id="content-box1">
    <img src="data/presente.gif" height="32" width="32"
    id="doacao" style="float:right;"> <div style="">Doação</div>
    </div></a>
    <br><br>
    <a href="contato.html"><div id="content-box1">
    <img src="data/telefone.gif" height="32" width="32"
    id="contato" style="float:right;"> <div style="">Contato</div>
    </div></a>
    <br><br>
    <a href="mais.html"><div id="content-box1">
    <img src="data/mais.gif" height="32" width="32"
    id="mais" style="float:right;"> <div style="">Mais</div>
    </div></a>

  </div>

添加了此CSS

.menu { width: 30%; float: left; }