html - 如何完全删除右边距? [英] html - how to remove right margin completely?

查看:89
本文介绍了html - 如何完全删除右边距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在下面的图片中的黑色矩形完全适合窗口;

I want the dark rectangle in the picture below to be completely fit within the window;

我设置 margin-left:-8px; 完全删除左边距;但是右边距是多少?(改变 margin-right 没有这个效果)我怎么能删除它,使黑色矩形接触边框?

I set margin-left:-8px; to remove the left margin completely; but what about the right margin?(changing margin-right doesn't have that effect) how can I remove that too so that the dark rectangle touches the border?

我的代码:

<html>
<head>
<body>
<span style="margin-left:-8px; display:inline-block; width:100%; background:#2F4F4F";><font face="Georgia" size="3" color="#FFFFFF">hello world!</font></span>
</body>
</head>
</html>

推荐答案

您可能想删除html / body元素的padding / margin:

You might want to remove the padding/margin on the html/body elements:

body, html { margin:0; padding:0; }

这篇关于html - 如何完全删除右边距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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