Html 如何删除 div-CSS 中的边框线

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26860884/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:02:26  来源:igfitidea点击:

How to remove the border line in a div-CSS

htmlcssborder

提问by Sarti

I'm using the following css to style a div:

我正在使用以下 css 来设置 div 的样式:

.mod head-update{
    height: 40px;
    border-style: none!important;
    padding-bottom: 20px;
    padding-top: 20px;
}

Yet I get 2 grey lines at the top and bottom of the div. How can I remove it?

但是我在 div 的顶部和底部有 2 条灰线。我怎样才能删除它?

回答by Roko C. Buljan

You should most probably fix your selector head-updatewith a class .or ID #like: .head-update(or #head-update?)

您很可能应该head-update使用类.或 ID 来修复您的选择器,#例如:(.head-update#head-update?)

Try with

试试

border: none !important;

(P.S note the space between noneand !important)

(PS注意之间的空间none!important

回答by MineAndCraft12

Without testing it myself, here's how I would modify the borders there, like others say...

没有自己测试,这就是我如何修改那里的边界,就像其他人说的那样......

border: none !important;

And uunless you want something to try and override it, I would get rid of !important.

除非你想要尝试覆盖它,否则我会摆脱!important.

Another thing I would do is try to state the background-color.

我要做的另一件事是尝试说明background-color.

background-color: #FFFFFF;

And, if you don't have too many of the element and you don't mind a styleattribute on your tag, you could possibly do this, which should override any CSS rules that go against it...

而且,如果您没有太多元素并且您不介意style标签上的属性,您可能会这样做,这应该覆盖任何违反它的 CSS 规则......

<div class="..." style="border:none; background-color:white"></div>

There could be a background of gray somehow and another element inside the div that has a background-color of white. With the padding, that would cause there to be some space above the inner-lying white divand the parent div(the one your trying to fix) could somehow get a background-color of gray from something.

不知何故,可能有灰色背景,而 div 中的另一个元素具有白色背景色。使用填充,这将导致内部白色上方有一些空间,div并且父级div(您试图修复的那个)可能会以某种方式从某物获得灰色的背景颜色。

回答by Nyasha

Try this : )

尝试这个 : )

margin: -8px;
...

回答by Dr NVS

I solved it by making the same background color for the container div as below.

我通过为容器 div 制作相同的背景颜色来解决它,如下所示。

<div class="row" style="width: 100%;background-color: #250505;">
    <div style="background-color: #250505; width: 10%;float:left;font-size: 32px;border: none !important; ">
    content .........
    </div>
    <div style="text-align:center;font-size:2.2vh;color:rgb(255, 255, 255); width:80%; font-weight:700;background-color: #250505;">
      content .....................
    </div>
    <div style="background-color: #250505; width: 10%;float:right;font-size: 32px; border: none !important;">
      content .............
    </div>

  </div>

回答by Avinash Antala

change

改变

border-style: none!important;

to

border : none !important;