twitter-bootstrap 如何在 Bootstrap 4 中使卡头无边框半径?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46316719/
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-10-22 01:04:25  来源:igfitidea点击:

How to Make Card Header No Border Radius in Bootstrap 4?

htmlcsstwitter-bootstrapborderbootstrap-4

提问by Robert

How can make the card-header have no border radius on bootstrap 4? I've implemented this one BUT the background color of the card-header overlaps the card-header therefore the card-header still have border-radius

如何使卡头在引导程序 4 上没有边框半径?我已经实现了这个,但是卡头的背景颜色与卡头重叠,因此卡头仍然具有边界半径

.card-header {
    height: 50px;
    background-color: #000;
    border-bottom-color: #fff;
    border-top: none;
    border-radius: 0;
}

回答by dev-siberia

To remove the radius, specify a class rounded-0. Bootsrap 4.

要移除半径,请指定一个类rounded-0。引导程序 4.

<button type="button" class="btn btn-primary rounded-0">...</button>

回答by drews

As you wrote in your comment, Bootstrap adds border-radiusto the first-childof .card-header.

正如你在写评论,引导添加border-radiusfirst-child.card-header

I suggest, that this is in this case the background-color.

我建议,在这种情况下,这是背景颜色。

When you overwrite it, it should be solved:

当你覆盖它时,它应该解决:

.card-header:first-child {
  border-radius: 0;
}

JSFiddle

JSFiddle

回答by Jonjie

You may try this:

你可以试试这个:

.card-header:first-child {
  border-radius: 0;
}

回答by MrLobster

This is how I did it in SCSS

这就是我在 SCSS 中所做的

@if $enable-rounded == false {
  .card {
    .card-header {
      border-radius: 0;
    }
    .card-body {
      border-radius: 0;
    }
    .card-footer {
      border-radius: 0;
    }
  }
}

You will have to include the SCSS variable $enable-rounded before loading bootstrap SCSS.

在加载引导程序 SCSS 之前,您必须包含 SCSS 变量 $enable-rounded。

回答by ARGVN

This worked for me. Try

这对我有用。尝试

.card, .card-header, .card-body, .card-footer{
    border-radius:0px !important;
}

回答by Jepf

<div class="card"><div class="card-header">...

You need to declare border-radius: 0;for both classes card& card-header

您需要声明border-radius: 0; 卡头两种类别