元素对齐问题 - 负边距、图像等
我正在尝试制作一个超出侧边栏边界的标题,并有一个阴影图像,使其看起来像一个书签。
与此类似的东西: http://inelmo.com/images/img2.png
现在我我尽力了,但看起来不正确。这是我的侧边栏和标题代码,我认为应该可以实现这种效果,但事实并非如此。
HTML
<!-- Sidebar -->
<aside id="sidebar">
<!-- header div -->
<div id="sideProfile">
<!-- Span with image background -->
<span id="sideHshadow"></span>
</div>
</aside>
CSS
#sidebar {
padding: 15px;
width: 400px;
}
/*Span with shadow image to make it look like a bookmark */
#SideHshadow {
height: 6px;
width: 12px;
margin: 0 0 -6px 0;
float: right;
background: url("../images/sidebar_header_shadow.png") no-repeat;
}
#sideProfile {
background:#333333;
border-bottom: 1px solid #2d2d2d;
height: 50px;
width: 400px;
margin: 0 -12px 0 0;
box-shadow: 0 1px 2px #77bee6;
-moz-box-shadow: 0 1px 2px #77bee6;
-webkit-box-shadow: 0 1px 2px #77bee6;
-webkit-border-radius: 7px 7px 0 7px;
-khtml-border-radius: 7px 7px 0 7px;
-moz-border-radius: 7px 7px 0 7px;
border-radius: 7px 7px 0 7px;
}
有人知道如何使其看起来像示例中的那样吗? Thnx
这是#sideHshadow 背景图像文件: http://inelmo.com/images/sidebar_header_shadow.png
I'm trying to make a header that goes outside the borders of my sidebar and has a shadow image that makes it look like it is a book-mark.
Something similar to this: http://inelmo.com/images/img2.png
Right now I tried my best, but it is not looking correct. here is my code for sidebar and header That I think should work to make this effect, but it isn't.
HTML
<!-- Sidebar -->
<aside id="sidebar">
<!-- header div -->
<div id="sideProfile">
<!-- Span with image background -->
<span id="sideHshadow"></span>
</div>
</aside>
CSS
#sidebar {
padding: 15px;
width: 400px;
}
/*Span with shadow image to make it look like a bookmark */
#SideHshadow {
height: 6px;
width: 12px;
margin: 0 0 -6px 0;
float: right;
background: url("../images/sidebar_header_shadow.png") no-repeat;
}
#sideProfile {
background:#333333;
border-bottom: 1px solid #2d2d2d;
height: 50px;
width: 400px;
margin: 0 -12px 0 0;
box-shadow: 0 1px 2px #77bee6;
-moz-box-shadow: 0 1px 2px #77bee6;
-webkit-box-shadow: 0 1px 2px #77bee6;
-webkit-border-radius: 7px 7px 0 7px;
-khtml-border-radius: 7px 7px 0 7px;
-moz-border-radius: 7px 7px 0 7px;
border-radius: 7px 7px 0 7px;
}
Anyone knows how to make it look like in example? Thnx
Here is the #sideHshadow background image file: http://inelmo.com/images/sidebar_header_shadow.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个纯 CSS 版本: http://jsfiddle.net/bcZKh/2/
代码如下:
Here's a pure CSS version: http://jsfiddle.net/bcZKh/2/
Code below: