简体   繁体   English

无法在HTML中并排放置两个div

[英]Trouble with making two divs side by side in html

I'm making a website, and I need to have two divs side by side, but instead one is below the other. 我正在制作一个网站,我需要并排有两个div,但是一个在另一个之下。 I am using align="left" on the first one, and align="right" on the second. 我在第一个上使用align =“left”,在第二个上使用align =“right”。

Here is the full body of the page - http://pastebin.com/Cxg1RbXW 以下是该页面的全部内容 - http://pastebin.com/Cxg1RbXW

Also, here's the style.css sheet - http://pastebin.com/pTaV6AsQ 另外,这是style.css表 - http://pastebin.com/pTaV6AsQ

Any help would be appreciated. 任何帮助,将不胜感激。

You need to use float:left|right . 您需要使用float:left|right Check out the MDN docs . 查看MDN文档

Here's a working fiddle to demonstrate . 这是一个工作小提琴演示

.left, .right {
    float:left;
}

you have to float your divs so they can reside side by side together: 你必须漂浮你的div,这样他们可以并排居住:

#right, #left {
float:left;
}

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

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