我可以在伪选择器图像之前或之后放置边框半径吗? [英] Can I put a border radius on a before or after pseudo selector image?

查看:52
本文介绍了我可以在伪选择器图像之前或之后放置边框半径吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在content:''属性中放置图像url()时,有什么方法可以在:before或:after上获得边框半径吗?

Is there any way I can get a border-radius on a :before or :after when I put an image url() in the content:'' property?

推荐答案

是的,您可以在伪元素 :: after 中使用 border-radius ::之前中带有背景图片:

Yes you can use border-radius in pseudo-elements ::after, ::before with an background image:

div:before {
  content: "";
  display: block;
  width: 200px;
  height: 100px;
  background-image: url(http://placehold.it/200x100);
  border-radius: 10px;
}

<div></div>

这篇关于我可以在伪选择器图像之前或之后放置边框半径吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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