【问题标题】:How to get rid of empty space around the border of Image [duplicate]如何摆脱图像边界周围的空白区域[重复]
【发布时间】:2020-05-18 00:51:42
【问题描述】:

我想让图像完全位于屏幕的右侧和顶部。

body{
font-family: 'Roboto', sans-serif;
font-weight: 300;
background: #822B2B;
color: #ffffff;
overflow: hidden; }


#showcase{
display: flex;
justify-content: center;
align-items: center;
text-align: center;
/* margin-left: 116px; */
/* width: 180vh; */
height: 100vh;

background: url('https://images.pexels.com/photos/1402787/pexels-photo-1402787.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260') no-repeat center center / cover; }

如有任何需要澄清的问题,请随时提出。 代码在:https://codepen.io/zaidik/pen/WNQYbXz

【问题讨论】:

  • 您能否发布 HTML 以便我们查看您的 CSS 的上下文
  • 我得到了解决方案,我只需要包含 margin: 0;在体内。

标签: html css image background space


【解决方案1】:

margin:0; 添加到您的正文 CSS 规则中

【讨论】:

  • 非常感谢您。它解决了我的问题!