Home  >  Article  >  Web Front-end  >  css div_html/css_WEB-ITnose

css div_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:27:381204browse

前言:width和heigth不会相互作用 ,各自为政!

 

1、当div设置了固定的长度和宽度后

高度和宽度都行!:不管里面有没有内容(可以无视内容),div就是一个框子在那(默认无边框)!即使内容超出,尺寸也不变!

#select_box {
WIDTH: 330px; HEIGHT: 40px;border:2px solid red;
}



 

显示效果:

2、若是div设置为百分比的形式

宽度无论如何都行!:width:50%;能行! 无视内容! 即使内容超出宽度框的宽度还是50%,内容超出框而存在;

高度无论如何都不行!:heigth:50%则不行 高度为内容的高度,如要设置高度 需要用height:50px 则可以,此时即使没有内容也会有框出现!

注意width总是以外层的对象为比较标准的!

 

3、嵌套div形式

绝大部分情况是:

父子互不干涉 两个框同时出现!

追加的内容会显示

 

4、若在div中设置了BACKGROUND: url(../images/ubox-select.gif) no-repeat 0px 0px

4.1、div很小时  只显示图片的固定区域!

4.2、div很大时,图片具体情况根据:no-repeat 0px 0px参数而定!

 

 

Statement:
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