简体   繁体   English

Div的水平对齐不正确

[英]Div's not properly aligning horizontally

Here is the site in question: http://jayduff.co.uk/ 这是有问题的网站: http : //jayduff.co.uk/

I previously had the images/links on the left and the header on the left, I decided to change it to make it more standardized but the top two divs that hold the title and the links don't seem to align up properly anymore? 我以前在左侧有图像/链接,在左侧有标题,我决定对其进行更改以使其更加标准化,但是保存标题和链接的前两个div似乎不再正确对齐了?

Here is the CSS for both my link div and my title div (you can also view the source of my link above) 这是我的链接div和标题div的CSS(您也可以在上面查看我的链接的来源)

    #title { 
      float:left;
      font-family: 'BebasNeueRegular', sans-serif;
      font-color: #6D929B;
      -webkit-font-smoothing: antialiased; 
      text-rendering: optimizeLegibility;  
    }

    #links { 
      margin-top:40px;
    }

I then have a div below... which holds my body text 然后,我在下面有一个div ...,其中包含我的正文

   #mainText {
     width: 450px;
     word-wrap: break-word; 
     margin-left:45px;
   }

I'm pretty sure I am missing something from the div styles above and that is causing the top two divs to not be properly aligned with the third div below it? 我很确定我从上面的div样式中丢失了一些东西,这导致前两个div与下面的第三个div不能正确对齐?

Here is an example of how it should be 这是应有的示例

title                links
**************************** 
* JOSHUA DUFFY *  O O O O  *                                                         
****************************
* mainbody                 *
*                          *
*                          *
****************************

Hope that makes sense, where am I going wrong? 希望这是有道理的,我要去哪里错了? I'm pretty sure its not the placement of my divs just the attributes above? 我很确定不是仅将div放在上面的属性中吗? Thanks in advance 提前致谢

try this 尝试这个

  #mainText {
        clear: both;
        margin-left: 45px;
        width: 450px;
        word-wrap: break-word;
    }

#links {
    float: left;
    margin-top: 40px;
}

#title {
    float: left;
    font-family: 'BebasNeueRegular',sans-serif;
    text-rendering: optimizelegibility;
}

From what I can see, you are missing float:left; 据我所知,您缺少了float:left; on your links div style.... 在您的链接div样式上...。

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

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