CSS重置 - 它是什么? [英] CSS reset - What exactly does it do?

查看:69
本文介绍了CSS重置 - 它是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这个reset.css文件在一个jquery图像滑块演示,但它从来没有包括在主index.html文件。什么是假设要做,更重要的是,你在哪里放?

I found this reset.css file inside a jquery image slider demo, but it was never included in the main index.html file. what is is suppose to do, and more importantly, where do you put it? Do you put it before any referenced stylesheets()?

以下是reset.css中的代码

Here is the code inside reset.css

/* CSS reset */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { 
    margin:0;
    padding:0;
}
html,body {
    margin:0;
    padding:0;
}
table {
    border-collapse:collapse;
    border-spacing:0;
}
fieldset,img { 
    border:0;
}
input{
    border:1px solid #b0b0b0;
    padding:3px 5px 4px;
    color:#979797;
    width:190px;
}
address,caption,cite,code,dfn,th,var {
    font-style:normal;
    font-weight:normal;
}
ol,ul {
    list-style:none;
}
caption,th {
    text-align:left;
}
h1,h2,h3,h4,h5,h6 {
    font-size:100%;
    font-weight:normal;
}
q:before,q:after {
    content:'';
}
abbr,acronym { border:0;
}


推荐答案

标准化了如何工作,每个浏览器都实现了什么是正确的。其中一个原因,你看到这么多关于IE中的风格错误的问题是因为IE是浏览器与其他浏览器在样式方面最不相似。虽然IE已经改进,所以有其他浏览器,他们仍然应用他们的
自己的边界,填充和边距,缩放,字体到元素,给页面自己独特的感觉。一个例子是,chrome给文本框自己的黄色边框。 重置实际上重置所有这些样式为零/无,以便您不会看到您没有应用在您的页面中的任何样式。

In the beginning there was no standardisation on how styles worked, each browser implemented what it felt was right. One of the reasons you see so many questions about style errors in IE is because IE was the browser with most dissimilarities from other browsers in terms of styling. Though IE has improved and so have other browsers they still apply their own borders, padding and margins, zoom, fonts to elements to give their own unique feel to pages. One example is, chrome gives its own yellow borders to text boxes. The "reset" actually "resets" all these styles to zero/none, so that you don't see any styles you haven't applied in your page.

如果这些样式不是重置,您将看到不想要的样式/效果和事情打破。它总是建议重置浏览器的样式。

If these styles are not "reset", you will see unwanted styles/effects and things breaking. Its always recommended to "reset" the browser's styles.

查看本文您应重置CSS吗?

这篇关于CSS重置 - 它是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆