简体   繁体   English

CSS填充问题,填充不起作用

[英]CSS padding issue, padding not working

Im trying to use padding to push an image 18px from the top of a div. 我试图使用填充从div的顶部推送图像18px。 Neither margin or padding are working, and after comparing the two padding seems to be what I want anyway. 边距或填充都没有工作,并且在比较两个填充之后似乎是我想要的。

The problem is with the footer-middle-left-left-image div tag. 问题在于footer-middle-left-left-image div标签。 The margin on the text one works fine though. 文本上的边距可以正常工作。


Here's the html: 这是html:

<div id = "footer-middle-left-left">
     <div id = "footer-middle-left-left-picture">
          <img src = "" alt = "some_text">
     </div>
     <div id = "footer-middle-left-left-text">
          If you would like to join our newsletter, please enter your </br>
          email address below.
     </div>
     <div id = "footer-middle-left-left-email">
     </div>
</div>

The CSS I have is: 我拥有的CSS是:

#footer-middle-left-left {
    float: left;
    width: 483px;
    height: 175px;
}

#footer-middle-left-left-image {
    float: left;
    width: 483px;
    height: 59px;
    padding-top: 18px;
}

#footer-middle-left-left-text {
    width: 483px;
    height: 58px;
    float: left;
    margin-left: 25px;
    color: white;
}

#footer-middle-left-left-email {
    height: 58px;
    float: left;
    width: 483px;
}

Any help would be appreciated! 任何帮助,将不胜感激! Also any advice, anything at all would be nice too. 任何建议,任何事情都会很好。 I'm pretty new so advice not relevant to my problem is also appreciated, like is this a good id-naming convention, etc.. 我很新,所以与我的问题无关的建议也很感激,就像这是一个很好的id命名约定等。

In html you have footer-middle-left-left-picture but in css #footer-middle-left-left-image Is it this bug or you just make mistake on paste code? 在html中你有footer-middle-left-left-picture但是在css #footer-middle-left-left-image是这个bug还是你只是在粘贴代码上犯了错误?

http://jsfiddle.net/CmwHu/ http://jsfiddle.net/CmwHu/

#footer-middle-left-left-image this id doesnt exist in your html. #footer-middle-left-left-image这个id在你的html中不存在。

So i have changed footer-middle-left-left-picture to #footer-middle-left-left-image . 所以我将footer-middle-left-left-picture改为#footer-middle-left-left-image It is working now 它现在正在运作

DEMO DEMO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM