亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我的 <img> 和 <div> 之間有一個灰色的“欄”

為什么我的 <img> 和 <div> 之間有一個灰色的“欄”

梵蒂岡之花 2023-10-17 15:19:44
<img>顯示 SVG 的 和之間有一條灰線<div>。這是屏幕截圖和部分代碼。.svg{    width: 100%;    height: auto;     display: block;}.title-container{    // center the title into the container    display: flex;     width: 100%;    justify-content: center;    background-color: $white;    padding-top: 10px;}<img src="assets/oblique.svg" class="svg"/><div class="title-container">    <a href="/" >Example</a></div>我已經嘗試過的我已經嘗試將邊距、填充和邊框設置為 0px,但不起作用。我已經嘗試將邊距、填充或邊框設置為 -1px,但它會產生溢出。
查看完整描述

1 回答

?
小唯快跑啊

TA貢獻1863條經驗 獲得超2個贊

看起來您正在嘗試在 div 上制作斜頂。

您可能喜歡另一種沒有 SVG 的方法。

使用border-image:


body {

  background: #15100e

}


.title-container {

  display: flex;

  width: 100%;

  justify-content: center;

  background-color: white;

  background-clip:padding-box;

  padding-top: 10px;

  border-top: solid 50px;

  border-image: linear-gradient(to bottom right, transparent calc(50% - 1.5px), #fff 50%) 100% 0 0 0 / 50px 0 0 0

}

<div class="title-container">

  <a href="/">Example</a>

</div>


查看完整回答
反對 回復 2023-10-17
  • 1 回答
  • 0 關注
  • 110 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號