对齐3< div>单线。 [英] Align 3 <div> s in single line.

查看:139
本文介绍了对齐3< div>单线。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要在一行中对齐3个

标签,如Left,Center,Right。我使用了以下代码,但它在下面逐个显示内容。



  <   div     id   =  content-left    align   =  left    unselectable   =  on > <   / div  >  <   div     id   =  content-center   对齐  =  center   无法选择  =  on > 中心<   / div  >  <   div     id   =  content-right    align   =   right    unselectable   =  on  > 正确<   / div  > ;  





OutPut

------------- ---------

剩下

中心

正确



那么如何查看下面的内容。



左中右边



可以有人帮我解决这件事吗?



谢谢和问候,

Chiranthaka

解决方案

是的,这是可能的......



检查这个 http://jsfiddle.net/v9djw3t3/1/ [ ^ ]



希望您正在寻找...


有几种方法可以做到这一点。上面的代码,没有随附的可能的现有css文件显示与Chrome中的不同。一,你需要取出内联样式(在元素内)至少align =的东西,并使用head部分中的样式标记或css文件进行良好的编程实践。但是下面会产生你想要的东西(在Chrome中使用括号编辑器):





div {float:left;}







如果你的css文件中有其他内容,你将不得不玩css。请阅读浮点数,弹性箱等,因为它将有助于理解这种对齐的东西。


Hi All,

I need to align 3

tags in one line like Left, Center, Right. I used the following code but it displayed the content one by one in below.

<div id="content-left" align="left" unselectable="on">Left</div><div id="content-center" align="center" unselectable="on">Center</div><div id="content-right" align="right" unselectable="on">Right</div>



OutPut
----------------------
Left
Center
Right

So how can I view the content like in the below.

Left Center Right

Could someone help me to solve this matter?

Thanks and regards,
Chiranthaka

解决方案

Yes it is possible...

Check this http://jsfiddle.net/v9djw3t3/1/[^]

Hope you are looking for this...


There are a few ways to do this. Your code above, without the accompanying possible existing css file displays differently as is in Chrome. One, you need to take out the inline styling (within elements) at least the "align=" stuff and use the style tag in your head section or a css file for good programming practice. However the following produces what you want initially (in Chrome using brackets editor):


div {float: left;}



You will have to play with the css if there are other things at play in your css file. Please read up on floats, flexbox etc as it will assist greatly in understanding this alignment stuff.


这篇关于对齐3&lt; div&gt;单线。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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