浏览器用户代理样式表边距8px [英] Browser user agent style sheet margin 8px

查看:479
本文介绍了浏览器用户代理样式表边距8px的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想在网站周围的空白处徘徊.由于用户代理样式表(Google Chrome),我发现它在那里,默认情况下,body标记的边距设置为8px.

I was just wonerdering about a white space all around a website. I found out it is there because of the user agent style sheet (Google Chrome) and there is set a margin of 8px to the body tag as default.

如何解决这个问题不是问题,但是我对这种余量的原因很感兴趣.我进行了搜索,但只找到了将边距设置为零的解决方案,但我想知道为什么会有此边距.

How to solve this is not a problem, but I am interested in the reason of this margin. I searched for it, but I only find solutions to set the margin zero, but I want to know why this margin is there.

希望您能告诉我有关这些用户代理样式表的更多信息.

Hope you can tell me more about these user agent stylesheets.

问候 菲利普(Philipp)

Greetings Philipp

推荐答案

浏览器添加了自己的样式表以及适当的规则,以显示通常应如何呈现网页,例如,外观良好.由于某些原因您不为标题添加css规则,那么应如何在浏览器中显示它?

Browsers add their own stylesheet with their proper rules to show how the web page should be rendered normally good looking for eg. some reason you'd not add css rules for headers then how it should be displayed in the browsers?

为回答该问题,浏览器添加了规则,以向网页标题显示通常的外观.

To answer the question browsers add their rules to show the web page headers how would normally look like.

就像@Quentin指出的那样,浏览器在正文中使用margin:8px;以更清晰的视觉方式显示网页就像写在纸上一样.

Like that the browsers using margin:8px; in body to show a web page in a cleaner visual way as pointed out by @Quentin is as writing in a paper.

那么,我们是开发人员,页面应该如何呈现?

So, we are the developer and how should be the page rendered?

为回答这个问题,我们添加了自己的样式表,并在页面上采用了自己的视觉效果方式.

To answer this we add our own stylesheet and make our own way for visual effect on the page.

不同的浏览器默认在浏览器中添加的样式表中有很多规则.您可以在此处在不同的浏览器上看到它们.

There are a lot of rules in the stylesheet added by browsers in default by different browsers. You can see them here for different browsers.

您可能会发现几个CSS重置样式表

And you may find several css reset stylesheet googling.

这篇关于浏览器用户代理样式表边距8px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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