如何将div元素对齐到不同的大小? [英] How to align the div element to different size ?

查看:97
本文介绍了如何将div元素对齐到不同的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友



如何将div元素对齐到不同的大小?例如:我想在单行中显示图像,登录详细信息,一些内容,指导我如何对齐div?在CSS中我应该使用%或px或em?







谢谢

Hello friends

How to align the div element to different size ? Ex: I want to display Image,login details,some content all in single row,guide me how to align the div ? in css what should I use either % or px or em ?



Thanks

推荐答案

这是你在想什么?



注意一,二,三个需要在彼此之后否则你会得到一个有趣的间距(div三将下降到一个新的行)。



Is this what you are thinking?

Note divs one, two, three need to be right after each other otherwise you will get a funny spacing(div three will drop to a new row).

<div style="width:480px; border:1px solid purple; ">
    <div style="width:40%; display:inline-block;">First</div><div style="width:20%; display:inline-block;">Second</div><div style="width:40%; display:inline-block;">Third</div>
</div>


这篇关于如何将div元素对齐到不同的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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