CSS中的负边界半径? [英] Negative Border Radius in CSS?

查看:79
本文介绍了CSS中的负边界半径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CSS来制作一个如下所示的div:

I'm trying to do CSS to make a div that looks like this:

我几乎是从这个开始的:

I'm pretty much started with this:

.player {
    width: 480px;
    height: 80px;
    border-radius: 40px;
}

在没有太多代码的情况下最简单的方法是什么?

Whats the simplest way to do this, without too much code?

推荐答案

您可以使用before伪元素来提供剪切"

You can use the before pseudo element to provide the "cut out"

.player {
    width: 480px;
    height: 80px;
    border-radius:0 40px 40px 0;
    background-color:#0000FF;
    position:relative;    
    color:#FFF;
}

.player:before
{
    width: 80px;
    height: 80px;
    border-radius:0 40px 40px 0;
    background-color:#FFF;    
    display:inline-block;
    vertical-align: middle;
    margin-right: 10px;
    content: '';
}

<div class="player">Some Content</div>

这篇关于CSS中的负边界半径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆