div里面width属性如何影响是否换行?
男神
男神 2017-03-10 09:20:10
0
2
798

在div中写入随意写入一段字符,如果给这个div加上width属性,这些字符会在一行内显示,但是如果加上width属性,就会按照字符的排版进行换行。这是为什么呢

男神
男神

╰つ ゛思 绪 万 千 , 不 如 努 力 向 前 .ヽ

reply all(2)
数据分析师

How does the width attribute in a div affect whether to wrap or not? - PHP Chinese website Q&A - How does the width attribute in a div affect whether to wrap or not? - PHP Chinese website Q&A

Take a look around and learn.

迷茫

div作为一个块级容器,默认宽度为父容器的宽度。如果是body的一级子元素,则其宽度为body的宽度。

当你设置了width后,自然一行装不下的时候换到第二行。就像你不设置宽度,只要你内容足够多,会多行显示。

如果你想单行展示,可以设置CSS属性强制不换行


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!