简体   繁体   English

即使隐藏也显示CSS Div边框

[英]CSS Div border shows up even if hidden

I'm currently trying to reproduce a candle effect on a webpage. 我目前正在尝试在网页上重现烛光效果。 Here's the result : https://jsfiddle.net/Zenoo0/z9nejmn3/ 结果如下: https : //jsfiddle.net/Zenoo0/z9nejmn3/

HTML HTML

<div id="light"></div>

CSS CSS

#light {
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    position: absolute;
    background-color: rgba(255, 165, 0, 0.5);
    -webkit-box-shadow: 0 0 52px 52px rgba(255, 165, 0, 0.5);
    -moz-box-shadow: 0 0 52px 52px rgba(255, 165, 0, 0.5);
    box-shadow: 0 0 52px 52px rgba(255, 165, 0, 0.5);
    animation-name: lightFlicker;
    animation-duration:3ms;
    animation-delay:200ms;
    animation-timing-function: ease-in;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    z-index: 10;
}

As you can see, my background light still has a little border, even though I previously set it to none. 如您所见,即使我之前未将其设置为背景光,我的背景光仍然带有少许边框。 I can't seem to figure out how to remove it. 我似乎无法弄清楚如何删除它。

Thanks. 谢谢。

已添加到#light CSS filter: blur(4px);

为什么会<div>鼠标悬停后出现边框时增加大小? CSS</div><div id="text_translate"><p> 我正在构建一个导航栏并尝试像在 bbc.com 站点中那样进行操作 - 当鼠标悬停在某个项目上时,会出现一个彩色边框。 我用类似的东西做到了</p><pre>* { box-sizing: border-box; margin: 0; padding: 0; }.cont { display:flex; border: 1px solid gray; background-color: black; /* font-family: Arial, Helvetica, sans-serif; */ /* height: 2em; */ /* border-radius:5px; */ } a { margin-right:0.1em; border: 1px gray; border-style: none none none solid; padding: 0.5em; color: white; } /* #nav1 { border-style: none none none solid; margin-left: 3em; } */ #nav2:hover { /* border: 3px solid red; */ border-bottom: 3px solid red; cursor:pointer; } #nav4 { border-style: none solid none solid; margin-right: 5em; } &lt;div class="cont"&gt; &lt;a id="nav1"&gt;Home&lt;/a&gt; &lt;a id="nav2"&gt;News&lt;/a&gt; &lt;a id="nav3"&gt;Contact&lt;/a&gt; &lt;a id="nav4"&gt;About&lt;/a&gt; &lt;button id="button1"&gt;Sign in&lt;/button&gt; &lt;/div&gt;</pre><p> 但是当您将鼠标放在#nav4 项目上时,整个黑色背景会拉伸以显示红色边框。 为什么会这样? 我想'box-sizing:border-box;' 应该阻止它。</p><p> (第二点,我怎样才能将按钮放在页面的右上角,使其适用于任何尺寸的屏幕?)</p></div> - Why would a <div> inscrease in size when a border shows up after the mouse hovers it? CSS

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CSS div边框显示出来,但是是透明的 - CSS div border shows up, but is transparent CSS:边框填充div - css: border stuffs up div 隐藏在父边框后面的CSS div溢出 - Css div overflow hidden behind parent border CSS 旋转的 div 边框显示奇怪的轮廓 - CSS rotated div border shows odd outline 为什么会<div>鼠标悬停后出现边框时增加大小? CSS</div><div id="text_translate"><p> 我正在构建一个导航栏并尝试像在 bbc.com 站点中那样进行操作 - 当鼠标悬停在某个项目上时,会出现一个彩色边框。 我用类似的东西做到了</p><pre>* { box-sizing: border-box; margin: 0; padding: 0; }.cont { display:flex; border: 1px solid gray; background-color: black; /* font-family: Arial, Helvetica, sans-serif; */ /* height: 2em; */ /* border-radius:5px; */ } a { margin-right:0.1em; border: 1px gray; border-style: none none none solid; padding: 0.5em; color: white; } /* #nav1 { border-style: none none none solid; margin-left: 3em; } */ #nav2:hover { /* border: 3px solid red; */ border-bottom: 3px solid red; cursor:pointer; } #nav4 { border-style: none solid none solid; margin-right: 5em; } &lt;div class="cont"&gt; &lt;a id="nav1"&gt;Home&lt;/a&gt; &lt;a id="nav2"&gt;News&lt;/a&gt; &lt;a id="nav3"&gt;Contact&lt;/a&gt; &lt;a id="nav4"&gt;About&lt;/a&gt; &lt;button id="button1"&gt;Sign in&lt;/button&gt; &lt;/div&gt;</pre><p> 但是当您将鼠标放在#nav4 项目上时,整个黑色背景会拉伸以显示红色边框。 为什么会这样? 我想'box-sizing:border-box;' 应该阻止它。</p><p> (第二点,我怎样才能将按钮放在页面的右上角,使其适用于任何尺寸的屏幕?)</p></div> - Why would a <div> inscrease in size when a border shows up after the mouse hovers it? CSS 即使我的 css 文件中没有任何内容,css 也会显示? - css shows up even if I dont have anything in css file? 下拉CSS问题-悬停时会显示隐藏列表 - Dropdown CSS issue - hidden list shows up when hovered over 如何使用css将div的边框“向上”移动一个像素 - How to move a div's border “up” one pixel with css CSS BUG:溢出:隐藏; 在边框旁边留下空白区域(div 内的 div) - CSS BUG: Overflow: hidden; leaves empty white space next to border (div inside div) 隐藏背景与CSS的透明边框 - Transparent border to hidden background with CSS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM