The difference between CSS width:100% and width:auto
##1. Problem
When I was adjusting the tree structure some time ago, I found that if the node name of the tree is relatively long, the outer elements will not be opened under IE6, causing only half of the node name to be displayed, and the icon and name to wrap. It is displayed, but it displays normally under IE8 and IE9. After locating the problem, it was finally discovered that it was caused by the following attributes, as shown in red in the picture below. The problem can be solved by setting the width value to auto:
.TreeView,.TreeView ul{ width:100%;/*here changed to auto*/ background:url (./trstree-default-line.gif) repeat -y 0px center ;##}
|
[1] width:100% does not include
margin-leftmargin-right The attribute value of is directly taken as the width of its parent container plus the value containing margin-left/margin-right. If margin is set, the new width value is the width of the container plus the margin value. (Observe carefully) You will find that if margin is added, the corresponding side will have more blank space. And there will be more horizontal scroll bars because the width has exceeded the scope of the screen. (This is the body relative to the parent container). [2] width:auto contains the attribute value of margin-left/margin-right. Its value contains the values of margin-left / margin-right.
width:auto always occupies the entire line! ! ! The margin value is already included (that is, a whole line). If you want to set the margin value, use a whole line and then subtract the margin value to get the current width. The subtracted value is the blank of the corresponding side. The notable feature is that no horizontal scroll bar appears, that is, the width does not increase. [3] The display is not normal under IE6, but it is displayed normally under IE8 and IE9. It may be because IE8 and IE9 have different parsing of width:100% from IE6, but The two parsing width:auto are consistent.
The above is the detailed content of The difference between CSS width:100% and width:auto. For more information, please follow other related articles on the PHP Chinese website!

在html5中,width的意思是宽度,width属性定义元素内容区的宽度,在内容区外面可以增加内边距、边框和外边距,只需要给元素设置“元素{width:数值}”即可。

We'vepreviouslyreportedonleaksofanupcomingelectricPorscheBoxster,andPorschehaspreviouslycommittedtoEVsmakingup80%ofsalesby2030andconfirmedthatelectricBoxsterandCaymanmodelswouldbeintroducedalongsideitsregularpetrol-p

方法有像素值、百分比、em单位、rem单位、vw/vh单位、auto、fit-content、min-content、max-content。详细介绍:1、像素值(px):像素值是固定的,不论屏幕分辨率如何变化,它的宽度都是不变的。例如:width: 300px;2、百分比(%):百分比宽度是相对于父元素的宽度的。例如:width: 50%;3、em单位等等。

什么是AUTO币?AUTO币是Autonio生态系统的本地代币,作为一种加密货币,旨在为用户提供去中心化的交易和自动化交易服务。Autonio平台基于区块链技术,通过智能合约实现智能交易,为用户提供更高效且安全的交易体验。Autonio生态系统Autonio生态系统由AutonioFoundation开发,旨在通过去中心化的方式提供自动化交易和投资工具,以协助用户优化其交易策略并实现更高的收益。这一生态系统集成了AUTO代币、智能合约、交易机器人以及Autonio交易平台。Autonio的目标是

iframe中width是指定框架的宽度的意思,可以控制iframe框架在页面中的宽度展示。width可以接受的值:1、固定像素值,width="300px",框架宽度将始终保持不变,无论浏览器窗口的大小如何变化;2、百分比值,width="50%",框架的宽度将根据其父元素的宽度进行自适应调整;3、自动值,width="auto",框架的宽度将根据其内容的宽度进行自适应调整。

问题C语言中有哪些不同的存储类?用程序解释它们。解决方案存储类被定义为存在于C程序中的变量或函数的作用域和生命周期。存储类C语言中的存储类如下:autoexternstaticregister自动变量/局部变量关键字-auto也称为局部变量作用域-局部变量的作用域仅限于声明它们的块内。这些变量在块内部声明。默认值-垃圾值示例 演示#include<stdio.h>voidmain(){ autointi=1;{ 

The KroxWay, a kind of modern car radio, is now available as part of a crowdfunding campaign. Technically speaking, it is an tablet based on Android 13. The advantage is that it is not as dependent on a smartphone as devices that only support display

Crypto analyst Javon Marks has identified a mid-cap altcoin that can potentially make significant gains in this bull run. Based on his analysis, a 1,100% price surge is already in the works for this altcoin.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1
Easy-to-use and free code editor

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
