以下是自己平时学习累计的,比较杂,欢迎大家指正和补充
一、css重置(css reset)
这是我简单整理的,并不全,大家可以根据自己需要继续补充:
body,p,h1,h2,h3,h4,h5,h6,dl,dd{margin:0;font-size:12px;}
ol,ul{margin:0;padding:0;list-style:none;}
a{text-decoration:none;}
img{border:none;}
不用*{margin:0;padding:0;}是因为:div没有内外边距,p只有外边距问题没有内边距问题等等,性能问题也不好,大家可以自己写标签通过比如火狐的F12来看到元素的内外边距情况。
二、全屏遮罩
页面文档结构是:body
三、内嵌和块元素
内嵌元素:内容撑开宽度,不支持宽高,不支持margin和padding的上下边距,左右支持,代码换行被解析为空格(即并没有紧挨着在一排显示,而是每行显示一个那种情况)这种是被解析为一个空格的大小的间隙,是页面中文字大小的一半,比如body中设置为font-size为12px,则间隙为6像素
块属性标签:没有宽度时,默认撑满一排,支持宽高,支持所有css命令
img既不是内联也不是块,而是inline-block内联块元素
inline-block特性有:没有宽度的时候内容撑开宽度
ie6、ie7不支持块属性标签的inline-block(解决方案:用浮动)
四:cursor属性
cursor:url(xxx.cur),pointer;意思是:可以jpg、gif、png等,但可能有兼容性问题,最好用.cur格式,pointer意思是如果前面图片出问题出不来了,则使用pointer,相当于是个备用
五、浮动
1、不设置宽度情况下还是由内容撑开宽度
2、设置为浮动后则脱离了文档流
六、定位
定位:
1、绝对定位和浮动一样,使元素脱离了文档流,如果没设置宽度,则使块属性标签内容撑开宽度;
2、绝对定位使得内嵌元素支持宽高;
3、定位元素默认后者比前者的层级高(堆叠层次,但始终不到1),如需改变则使用z-index
4、fixed定位不设置宽度的话,可以让块元素内容撑开宽度,与绝对定位基本一致,的差别是始终相对整个文档进行定位,IE6不支持固定定位,可以通过js一起解决
5、在IE6下,父级的overflow:hidden是包不住设置为position:relative的子级的(这是当子元素高度高于父元素情况下,在一般情况下,设置为relative是对元素本身没影响的),那么要解决这个问题就是给父级加定位属性(相对或绝对定位都行)
6、在IE6下,如果定位元素的父级的宽高是奇数的话,那么该定位元素的right和bottom都有1像素的偏差,未找到较好的解决方案,则避免父元素宽高为奇数
七、清除浮动
1、给父级也加浮动,但父级还要父级怎么办?一层层加?扩展性不好,会导致:页面中所有元素都加浮动,margin左右自动失效(floats bad !),结论:不适用,放弃!!
2、给浮动元素的父级加display:inline-block,结论:不好,margin:0 auto失效!
3、给浮动元素后面加个空div,height:0px,但是在IE6下有个最小高度19px,但并不是所有元素都有最小元素,为了解决此问题,加个font-size:0;,但是也不能解决IE6下还剩2px的问题,(样式为:加个空div,class为clear,样式为:clear:both;font-size:0;height:0;)解决方案请听下回分解
4、给浮动元素后面加
,这个属性还有left、right等值,br是没有高度的,在br里的clear属性跟用clear:both作用是一样的,在ie6/7下都起作用了也省事,是可以用方案,但是,但是,不符合w3c标准:结构、样式、行为分离(写了个br标签,改结构了)
5、after伪类并不会改变文档结构,content:"内容内容"是不会改变结构的(通过F12可以看到,文档结构里的“内容内容”这几个字并不存在,但却可以在页面上显示出来,能看见),比如样式:p:after{content:"内容",background:red;width:10px;height:10px;}那么背景色变为红色的地方只会是“内容”,即这个content里的东西,p里面的文字背景色不会变化,并且宽和高也是对content里的东西起作用,不会影响p元素,但是在IE6/7下只支持a标签的那个4个伪类,不支持after伪类,但是没关系,因为在IE6/7下浮动元素的父级有宽度就不用清浮动,那不支持after伪类也没关系,为啥父级有宽度就不用清浮动了呢?这是因为在ie中有个haslayout的东西(不知道就百度百科)默认为false,有了width就能触发为true(哪些能触发去百度),haslayout会根据元素内容的大小或者父级的大小来重新计算元素高度,那么如果父级不给width怎么办呢?这时候就用zoom:1(百度百科里提到zoom除了normal外的值能激发haslayout为true),zoom有放大、缩小效果,所以一般这样用:给浮动元素的父级.clear{zoom:1};.clear:after{conetent:"";display:block;clear:both;}(前者解决ie6/7下的清浮动,后者解决其他浏览器下的清浮动),现在都是推崇这种清浮动方法,推荐、推荐!!
6、overflow可以包含着浮动元素,所以overflow可以制造清浮动假象,是加给浮动元素的父级的,此方法也可用,但是在IE6下有问题:因为overflow没有把元素提升层级的功能,那么配合zoom:1使用,可以激发haslayout,此方法还是少用,可能会隐藏本来应该显示出来的内容,推荐用第5种方法。
注意:clear这个属性只能加给块元素,对于内嵌是不起作用的!!

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
