Lines or borders that I don’t know how to remove.

huangapple go评论128阅读模式
英文:

Lines or borders that I don't know how to remove

问题

我用 <div> 创建了一个 display:grid; 带有 grid-areas 的元素,然后出现了一个边框或者我不知道是什么样的线,我无法去除它,看起来像是一个瑕疵。

我尝试去掉它,删除了 box-shadow 和所有边框,但它仍然存在,这让我很困扰...我只想去掉那些白色或某种灰色的线。

这是我的代码。我正在设置 315px 的最小宽度,以便手机用户有良好的外观。

问题的图像:
Lines or borders that I don’t know how to remove.

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(30deg, rgb(255, 188, 117), rgb(112, 206, 214));
  height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.div__grid-main {
  display: grid;
  height: 90%;
  width: 90%;
  grid-template-areas: "div__1 div__1 div__1" "div__2 div__x div__x" "div__3 div__3 div__3" "div__4 div__4 div__4" "div__5 div__5 div__5";
  grid-template-rows: .3fr .8fr .35fr 4fr .6fr;
}

/* 其他 CSS 规则... */

@media only screen and (min-width: 315px) {
  :root {
    --col-fondo-blanco: #eee;
    --col-fondo-transparent: rgb(35, 31, 141);
    --col-borde-gris: #dacece;
  }

  .div__grid-main {
    display: grid;
    height: 90%;
    width: 90%;
    grid-template-areas: "div__1 div__1 div__1" "div__2 div__x div__x" "div__3 div__3 div__3" "div__4 div__4 div__4" "div__6 div__6 div__6" "div__6 div__6 div__6" "div__5 div__5 div__5";
    grid-template-rows: .3fr 1.5fr .35fr 4fr 2fr 2fr 2fr .6fr;
  }

  /* 其他 CSS 规则... */
}
<script src="https://kit.fontawesome.com/2c2f9cb66d.js" crossorigin="anonymous"></script>
<div class="div__grid-main">
  <!-- 其他 HTML 元素... -->
</div>

希望这对你有所帮助。

英文:

I made a <div> display:grid; with grid-areas, then there is a border or idk what kind of line that is and I can't remove, it seems like a bad detail.

I try to remove it removing box-shadow, and all the borders, but it is still there, it's making me crazy... I just need to remove those lines that are like white or some kind of grey color.
Here is my code. I'm doing it in 315px min-width looking for a good look for cellphone users.

Image of the problem:
Lines or borders that I don’t know how to remove.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(30deg, rgb(255, 188, 117), rgb(112, 206, 214));
  /* background: purple; */
  height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.div__grid-main {
  display: grid;
  height: 90%;
  width: 90%;
  /* border: 2px solid none; */
  /* border-radius: 10px; */
  /* box-shadow: -1px 1px 10px rgba(27, 26, 26, .3);  */
  /*derecha abajo transparente?*/
  grid-template-areas: &quot;div__1 div__1 div__1&quot; &quot;div__2 div__x div__x&quot; &quot;div__3 div__3 div__3&quot; &quot;div__4 div__4 div__4&quot; &quot;div__5 div__5 div__5&quot;;
  grid-template-rows: .3fr .8fr .35fr 4fr .6fr;
}


/* div:first-child {
    border: 2px solid none;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

div:last-child {
    border: 2px solid none;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
} */

.div__1 {
  grid-area: div__1;
  background: rgb(52, 135, 92);
}

.div__1-p-plants {
  color: #eee;
  margin: 10px;
  text-align: center;
}

.div__2 {
  grid-area: div__2;
  /* background: #eee; */
  /* border-bottom: solid 1px #dacece; */
  /* border-right: solid 1px #eee; */
  display: flex;
  justify-items: center;
  align-items: center;
}

.div__x {
  grid-area: div__x;
  /* background: #eee; */
  /* border-bottom: solid 1px #dacece; */
  /* border-left: solid 1px #dacece; */
  display: flex;
  justify-content: right;
  /* Horizontal*/
  /* align-items: center;  */
}

.div__2-li {
  display: inline-block;
  margin-top: 20px;
}

.icono-1 {
  /* Acabo de hacer una modificaci&#243;n, esto se llamaba &quot;aaa&quot;, supongo que era el &#237;cono-1*/
  position: relative;
}

.div__2-a {
  margin: 50px;
}

.div__2-a-1 {
  margin-left: 10px;
  /* height: 40px; */
  /* justify-self: center; */
  position: relative;
  /* display: inline-block; */
}

.fa-leaf {
  font-size: 30px;
  /* margin: 0; */
  position: absolute;
  left: -30px;
  top: 5px;
}

.div__2-a-1::after {
  content: &quot;FAQ, Blog, Support&quot;;
  position: absolute;
  color: #afa6a6;
  display: block;
  width: 130px;
  bottom: 10;
  left: 0;
}

.fa-magnifying-glass {
  margin-right: 45px;
  font-size: 25px;
}

.div__2-p-tiltle-1 {
  margin-left: 20px;
  /* text-align: left; */
  font-size: 30px;
  /* background: #ca1d1d; */
  width: 100%;
}

.div__2-p-tiltle-1::after {
  content: &quot;&quot;;
  width: 100px;
  height: 1px;
  background: #000;
  display: block;
}

.div__3 {
  grid-area: div__3;
  /* background: #eee; */
  display: flex;
  /* justify-content: space-around; */
  justify-content: center;
  /* Horizontal */
  align-items: center;
}

a {
  color: #000;
  text-decoration: none;
  margin: 10px;
}

.div__4 {
  grid-area: div__4;
  background: #bfdbdb;
  display: flex;
  justify-content: right;
  align-items: center;
}

.div__4-p-titulo {
  font-size: 50px;
  position: relative;
  margin-top: 20%;
}

.div__4-p-titulo::after {
  content: &quot;Enjoy the feel-good vibes of the season with our easy-care plants and signature planters.&quot;;
  font-size: 12px;
  display: block;
  position: absolute;
}

.div__4-img-plants3 {
  height: 100%;
  width: 100%;
  object-fit: cover;
  /* display: block;
    margin-right: 0;
    margin-left: auto; */
}

.div__5 {
  grid-area: div__5;
  background: #eee;
}

.div__4-div-img {
  background: #bfdbdb;
  width: 50%;
  height: 100%;
}

.div__4-div-p {
  background: #bfdbdb;
  width: 50%;
  height: 100%;
  display: flex;
  justify-content: center;
  /* align-items: normal; */
  /* margin-top: 200px; */
  position: relative;
}

.btn {
  position: absolute;
  top: 58%;
  left: 19%;
  /* box-shadow:inset 0px 1px 0px 0px #289160; */
  background-color: #289160;
  border: 1px solid #289160;
  display: inline-block;
  cursor: pointer;
  color: #ffffff;
  font-family: Arial;
  font-size: 11px;
  font-weight: bold;
  padding: 8px 14px;
  text-decoration: none;
  transition-duration: 1s;
}

.btn:hover {
  background-color: #2f4723;
}

.div__6 {
  display: none;
}

.div__4-p-titulo-responsive {
  display: none;
}

@media only screen and (min-width: 315px) {
   :root {
    --col-fondo-blanco: #eee;
    --col-fondo-transparent: rgb(35, 31, 141);
    --col-borde-gris: #dacece;
  }
  .div__grid-main {
    display: grid;
    height: 90%;
    width: 90%;
    /* border: 2px solid none; */
    /* border-radius: 10px; */
    /* box-shadow: -1px 1px 10px rgba(27, 26, 26, .3);  */
    /* background: #000; */
    /* box-shadow: none; */
    /*derecha abajo transparente?*/
    grid-template-areas: &quot;div__1 div__1 div__1&quot; &quot;div__2 div__x div__x&quot; &quot;div__3 div__3 div__3&quot; &quot;div__4 div__4 div__4&quot;/* Donde est&#225; el t&#237;tulo */
    &quot;div__6 div__6 div__6&quot;/* Donde ir&#225; la imagen */
    &quot;div__6 div__6 div__6&quot; &quot;div__6 div__6 div__6&quot; &quot;div__5 div__5 div__5&quot;;
    /* Secci&#243;n en color blanco */
    grid-template-rows: .3fr 1.5fr .35fr 4fr 2fr 2fr 2fr .6fr;
    /* .3fr .8fr .35fr 4fr 6fr .6fr */
  }
  /* div {
        background: blue;
    } */
  .div__2 {
    background-color: var(--col-fondo-transparent);
    /* border-bottom: solid 1px var(--col-borde-gris); */
    /* border-right: solid 0px none; */
  }
  .div__x {
    grid-area: div__x;
    background-color: var(--col-fondo-transparent);
    /* border-bottom: solid 1px var(--col-borde-gris); */
    /* border-left: solid 0px none; */
    display: flex;
    justify-content: right;
    /* Horizontal*/
    /* align-items: center;  */
  }
  .div__3 {
    background-color: var(--col-fondo-transparent);
    /* border-top: solid 1px none; */
  }
  .li__padre-visit {
    /* Ac&#225; estoy controlando al li padre del &quot;Visit&quot; */
    /* display: flex; */
    /* justify-content: center; */
    /* align-items: center; */
  }
  .div__2-p-tiltle-1::after {
    content: &quot;&quot;;
    width: 100px;
    height: 1px;
    background: #000;
    display: block;
  }
  .div__4-div-img {
    display: none;
  }
  .div__4 {
    grid-area: div__4;
    background: #bfdbdb;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .div__4-div-p {
    display: none;
    /* background: #bfdbdb;
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative; */
  }
  .div__4-p-titulo-responsive {
    display: block;
    font-size: 40px;
    /* position: relative; */
    /* margin-top: 20%; */
    /* padding: 200px; */
  }
  .div__4-p-titulo-responsive::after {
    content: &quot;Enjoy the feel-good vibes of the season with our easy-care plants and signature planters.&quot;;
    font-size: 12px;
    display: block;
    position: absolute;
  }
  .div__6 {
    display: block;
    grid-area: div__6;
    background: #bfdbdb;
    width: 100%;
    height: 100%;
  }
  .div__6-img-plants3 {
    display: block;
    /* display: none; */
    height: 100%;
    width: 100%;
    object-fit: cover;
    /* padding: 1px; */
  }
  .icono-1 {
    display: none;
  }
  .icono-2 {
    display: none;
  }
  .a-hello {
    display: none;
  }
  .div__2-a-1::after {
    display: none;
  }
}

<!-- language: lang-html -->

&lt;script src=&quot;https://kit.fontawesome.com/2c2f9cb66d.js&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;div class=&quot;div__grid-main&quot;&gt;

  &lt;div class=&quot;div__1&quot;&gt;
    &lt;p class=&quot;div__1-p-plants&quot;&gt;Plants Make People Happy*&lt;/p&gt;
  &lt;/div&gt;

  &lt;div class=&quot;div__2&quot;&gt;
    &lt;p class=&quot;div__2-p-tiltle-1&quot;&gt;The Sill&lt;/p&gt;
  &lt;/div&gt;

  &lt;div class=&quot;div__x&quot;&gt;
    &lt;ul&gt;
      &lt;li class=&quot;div__2-li icono-1&quot;&gt;&lt;i class=&quot;fa-solid fa-leaf&quot;&gt;&lt;/i&gt;&lt;a class=&quot;div__2-a div__2-a-1&quot; href=&quot;&quot;&gt;Resources&lt;/a&gt;&lt;/li&gt;
      &lt;li class=&quot;div__2-li li__padre-visit&quot;&gt;&lt;a class=&quot;div__2-a a-skill&quot; href=&quot;&quot;&gt;Visit The Sill&lt;/a&gt;&lt;/li&gt;
      &lt;li class=&quot;div__2-li&quot;&gt;&lt;a class=&quot;div__2-a a-hello&quot; href=&quot;&quot;&gt;Hello, Sing In&lt;/a&gt;&lt;/li&gt;
      &lt;li class=&quot;div__2-li icono-2&quot;&gt;&lt;i class=&quot;fa-solid fa-magnifying-glass&quot;&gt;&lt;/i&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;ul&gt;
      &lt;!-- &lt;i class=&quot;fa-duotone fa-leaf&quot;&gt;&lt;/i&gt; --&gt;
    &lt;/ul&gt;
  &lt;/div&gt;

  &lt;div class=&quot;div__3&quot;&gt;
    &lt;a href=&quot;&quot;&gt;Inicio&lt;/a&gt;
    &lt;a href=&quot;&quot;&gt;Productos&lt;/a&gt;
    &lt;a href=&quot;&quot;&gt;Otros&lt;/a&gt;
    &lt;a href=&quot;&quot;&gt;&#191;Por qu&#233; nosotros?&lt;/a&gt;
    &lt;a href=&quot;&quot;&gt;Contactanos&lt;/a&gt;
    &lt;a href=&quot;&quot;&gt;Inicio&lt;/a&gt;
    &lt;a href=&quot;&quot;&gt;Inicio&lt;/a&gt;
    &lt;a href=&quot;&quot;&gt;Inicio&lt;/a&gt;
  &lt;/div&gt;

  &lt;div class=&quot;div__4&quot;&gt;
    &lt;p class=&quot;div__4-p-titulo-responsive&quot;&gt;Your Summer Sill&lt;/p&gt;
    &lt;div class=&quot;div__4-div-p&quot;&gt;
      &lt;p class=&quot;div__4-p-titulo&quot;&gt;Your Summer Sill&lt;/p&gt;

      &lt;a href=&quot;&quot; class=&quot;btn&quot;&gt;Shop Now&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;div__4-div-img&quot;&gt;
      &lt;img class=&quot;div__4-img-plants3&quot; src=&quot;/Plantas 3.jpg&quot; alt=&quot;Plants&quot;&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div class=&quot;div__6&quot;&gt;
    &lt;img class=&quot;div__6-img-plants3&quot; src=&quot;/Plantas 3.jpg&quot; alt=&quot;Plants&quot;&gt;
  &lt;/div&gt;

  &lt;div class=&quot;div__5&quot;&gt;&lt;/div&gt;


&lt;/div&gt;

<!-- end snippet -->

答案1

得分: 2

这个问题在FirefoxChromeEdge中并不存在,似乎只出现在Opera中。

通常,当页面未缩放到100%时,会出现这个渲染问题。

您可以使用<kbd>ctrl</kbd> + <kbd>0</kbd>(在Windows上)或<kbd>command</kbd> + <kbd>0</kbd>(在Mac上)来重置缩放。


特别是在Opera中,您可以从以下位置重置缩放:

工具 / 首选项 / 网页 / 新标签页的图像和缩放设置 / 页面缩放 / 100%

或打开URL opera:config#UserPrefs|Scale

英文:

The issue is not present in Firefox, Chrome or Edge and seems to be isolated to Opera.

This rendering issue usually happens when the page is not zoomed to 100%.

You can reset the zoom using <kbd>ctrl</kbd> + <kbd>0</kbd> on windows, and <kbd>command</kbd> + <kbd>0</kbd> on Mac.


In Opera specifically you can reset zoom from:

tools / preferences / webpages / images and zoom settings for new tabs / Page Zoom / 100%

or open url opera:config#UserPrefs|Scale

huangapple
  • 本文由 发表于 2023年3月7日 00:41:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75653510.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定