[英]How to append a image to the top of the box using css
Im having a menu which drop down when a div is hovered like this 我有一个菜单,当div像这样悬停时会下拉
http://www.flickr.com/photos/41695354@N08/5591505298/ http://www.flickr.com/photos/41695354@N08/5591505298/
I want to add a arrow at the top of that menu like this 我想像这样在菜单顶部添加一个箭头
http://www.flickr.com/photos/41695354@N08/5591505300/ http://www.flickr.com/photos/41695354@N08/5591505300/
How to achieve this 如何做到这一点
One of the ways is, you can style your "Account" box, so that it is position: relative
, so that inside this box, there is an arrow image, with position: absolute
, and you can adjust the top
and left
to position the arrow image right at the top of "Account" box. 一种方法是,可以对“ Account”框设置样式,使其position: relative
,以便在此框内有一个箭头图像,其position: absolute
,您可以调整top
和left
的位置“帐户”框顶部的箭头图像。
An absolute positioned element is absolute to the nearest ancestor element where the position is not static
. 绝对定位的元素相对于位置不是static
的最近祖先元素是绝对的。 So relative
counts. 因此relative
计数。 Just make sure there is no top
or left
set for the "Account" box. 只要确保“帐户”框没有设置top
或left
设置即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.