- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已经给图像 box-shadow
box-shadow: 0 0 10px RED inset
但是阴影没有出现在图像上,如果我使用 Firebug 改变图像的路径,那么我可以看到阴影在图像的背面。
我想给图片加阴影,请帮忙
最佳答案
使用 CSS 定位技术来实现......在这里,首先将图像包装在 div
元素中,然后使用 CSS 伪 :after
元素用 inset box-shadow
现在确保你已经设置了容器元素,在本例中它是一个 div
元素到 position: relative;
否则你的影子会飞出去。
div:after {
content: "";
position: absolute;
height: 100px;
width: 100px;
border-radius: 50%;
box-shadow: inset 0 0 12px blue;
top: 0;
left: 0;
z-index: 1; /* You can use higher to ensure that it stays on top */
}
我忘记使用 z-index
属性,所以将它用于 absolute
定位伪以确保它始终位于顶部...
另外,想在这里做一个说明,如果你想让 div
并排,你需要 float
或 display: inline- block ;
因为 div
元素本质上是 block 并且将占据文档 width
的 100%...
Demo (z-index
包含在此演示中)
如果出于某种原因您想忽略 :after
伪的使用(我看不出有任何理由这样做,因为 IE8 也支持它)所以你也可以在 img
元素上使用负的 z-index
,并使用 box-shadow
和 inset
div
元素上的值。
div {
position: relative; /* Not required now */
margin: 10px;
float: left;
box-shadow: inset 0 0 12px blue;
border-radius: 50%;
}
div img {
display: block;
height: 100px;
width: 100px;
border-radius: 50%;
position: relative;
z-index: -1;
}
Demo 2 (只是玩弄 z-index
属性)
关于html - img 上的框阴影插图不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23465832/
我有一个 png 文件 (1603px x 75px),我想将其用作某个部分的边框。但我希望它出现在内部(插图)而不是外部。但我无法弄清楚如何使边框图像恰好进入(插入)图像高度,而不会使图像的垂直尺寸
UIViewController ContainerView -> UITableViewController界面 View ContainerView -> UIViewController 当显示
我正在努力使我的标题具有漂亮的浮雕外观。它在 Chrome 中运行良好,但 Firefox 退出了。我怎样才能使这种效果在两者中都起作用?这是 fiddle : https://jsfiddle.ne
我有一个包含按钮的 UIBarButtonItem,我在该按钮上为按下/未按下状态设置了自定义背景图像。按下的图像向下移动 4px,因此未按下时的文本看起来垂直居中。我知道我可以使用 [button
uitabbarcontroller子类 隐藏/删除原始选项卡栏 将自定义视图置于uitabbarcontroller视图的底部 uitabbarcontroller->uiviewcontrolle
我试图在一个简单的客户端-服务器程序中说明 Nagle 算法。但我不太明白,也无法将其清楚地打印给我。 在我的示例中,客户端只是生成从 1 到 1024 的整数并将它们发送到服务器。服务器只是将这些
我正在使用 Netbeans GUI,我想在 jTextField 的开头添加 3 个像素的空间: 我已经尝试在 GUI 中使用 setMargin 和 setInset,但它没有改变任何东西。 我还
有没有办法使用 CSS3 在文本输入框上获得插入/内部阴影?下面的插入代码只会做盒子 -moz-box-shadow:inset 0 0 10px #000000; box-shadow:i
我正在对 CSS3 的新功能进行一些测试,但这种组合仅适用于最新版本的 Chrome 和 Firefox,但不适用于 Safari 或 Opera: box-shadow: inset
我想像这样使用 CSS3 获得文本字段效果:- 我尝试使用 CSS3 做到这一点,但未能获得完全相同的外观,请在 jsfiddle.net 中找到我的代码 CSS .field { -webkit-b
我正在使用 knitr::rmarkdown (但 knitr::knitr 和我的 VignetteEngine 一样) .然后我使用 devtools::build_vignettes() 构建我
我有一个具有固定布局边距的 StackView,为所有子元素提供左侧和右侧的边距。这对于大多数子元素(如标签等)非常有用。但是,我还有一个 tableView 作为子元素,它为单元格(例如字幕原型(p
我注意到来自 iPhone 专用应用程序和 Apple Watch 兼容应用程序的推送通知之间存在差异,我希望我的 Watch 兼容应用程序显示与普通 iPhone 专用应用程序推送通知类似的通知。
我正在尝试使用 d3.js 绘制 map ,该 map 具有城市 map 的一部分偏移并绘制在不同的位置( map 插图)。有使用 d3.js 的工作示例吗?如果没有,我是否可以使用不同的 .json
所以,这就是它需要的样子 你在中心看到漂亮的白色效果,我试图重新创建它,但没有成功,这是我的代码: article .txt:after{ position:absolute; c
我在 中添加了一个框阴影并添加了一个 元素到 div。框阴影显示在 div 上,但它不会影响视频元素。 这是预期的行为吗,有没有办法让方框阴影也影响视频? 代码片段: .video-player {
设置: 我正在 Xcode 5 中处理一个显示一组文本字段的 View 。为了在键盘出现时处理滚动,我使用 ScrollView 来放置我的 TextFields。我使用自动布局。 问题: 我正在努力
我有 Auto Complete Mode为 Emacs 安装。 首先:当我输入声明时,我会得到正常的自动完成行为: 所以我点击了 Tab 来完成——没问题。但后来我点击了 ;: 它会立即尝试完成某些
如您所见,我想将搜索栏恰好放在 safeArea 的顶部,但是 proxy.safeAreaInsets 没有正确的值,因为在PreviewProvider 父级使用 edgesIgnoringSaf
将应用沙盒化后,如何使用“从登录时开始”功能制作应用? 最佳答案 谢谢CORY BOHON,他创建了以下教程: http://martiancraft.com/blog/2015/01/login-i
我是一名优秀的程序员,十分优秀!