Home > Web Front-end > HTML Tutorial > css div的宽度随内部元素的宽度的变化而变化_html/css_WEB-ITnose

css div的宽度随内部元素的宽度的变化而变化_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:04:12
Original
1979 people have browsed it

div是块级元素,如果不设置他的明确的宽度,那他就等于父元素的宽度,如果要让其它随着子元素的变化而变化,需要改变他的属性,给他加上这个css属性即可display:inline-block

或干脆把div直接替换为span解决一切问题

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template