并排显示Div(左侧一个,右侧另一个) [英] Display Div side by side ( one on the left and other on right)

查看:666
本文介绍了并排显示Div(左侧一个,右侧另一个)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似
的代码

I have a code like


左侧Div


右侧Div




目前,内部的2个Divs会显示在另一个目录下.我如何并排显示它们?即一种在左侧,另一种在右侧



At present 2 Divs inside are displayed one below another. How can I display them side by side? i.e. one on the left and other on right side

推荐答案

一种方法是使用浮动div.主要问题是,一旦div达到一定的宽度,它们就会在彼此之上显示.解决方法是定义最大宽度.

http://jsfiddle.net/NuxAx/1/ [
One approach would be using floating divs. The main problem is that the divs will be displayed on top of each other as soon as they reach a certain width. The workaround is defining a max-width.

http://jsfiddle.net/NuxAx/1/[^]


添加样式

add style

leftdiv
{
position:absolute;
left:0px;
width:100px;//desired value
}
rightdiv
{
position:absolute;
left:600px;//total-width of this
width:100px;//desired value
}


您还可以在%中设置这些值....


you can set these values in % also....


您必须使用div的Float属性
You have to use Float property of div


这篇关于并排显示Div(左侧一个,右侧另一个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆