Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS3中的交叉口_Css - Fatal编程技术网

CSS3中的交叉口

CSS3中的交叉口,css,Css,是否可以使用CSS在这样的元素(div,span)中创建一个“孔”。我知道我可以用一个透明的图像来做,但我只是想知道它在CSS中是否可行 body {padding:70px; background:url(http://ipadinsight.com/wp-content/uploads/2011/11/AirPlayMirroring_thumb.jpg)} div {background:red;border-radius:10px;width:400px;height:100px}​

是否可以使用CSS在这样的元素(div,span)中创建一个“孔”。我知道我可以用一个透明的图像来做,但我只是想知道它在CSS中是否可行

body {padding:70px; background:url(http://ipadinsight.com/wp-content/uploads/2011/11/AirPlayMirroring_thumb.jpg)} 
div {background:red;border-radius:10px;width:400px;height:100px}​
试试这里的jsfiddle

不,DIV是一个“实体”

另一方面,您可以使用透明图片(png或gif)使某物看起来像一个洞。 只要你没有改变z-指数,你就不能在网络下与图层交互


您可以使用边框使其看起来像一个长方体,并保持背景色:透明

您可以通过将孔的背景图像设置为与基础元素相同的图像来模拟孔。这并不能使它真正透明


是的;你可以用纯css来做。 像这样:

body {padding:70px; background:url(http://ipadinsight.com/wp-content/uploads/2011/11/AirPlayMirroring_thumb.jpg);}

.parent {background:red;border-radius:10px;width:400px;height:100px;position:relative;}
.circle{

    float:right;
    position:absolute;
    right:-50px;
    top:0;
    bottom:0;
    width:50px;
    overflow:hidden;
}
.circle:after{
    content:"";
    width:40px;
    height:40px;
    -moz-border-radius:100px;
    display:block;
    border:red 50px solid ;
    margin-left:-45px;
    margin-top:-20px;
}
请检查这个实例


不过,您可以使用javascript将鼠标事件传递给其他对象,这可能是重复的。它没有按照我想要的方式工作。如何在这种情况下使右下边框和右上边框变圆