将鼠标悬停在 div 上时尝试显示图像
Trying to display image when hover over div
我在 css 中绘制了一个小的像素化字符。此字符位于名为 b 的 div 元素中。当我将鼠标悬停在 div 上时,我想在 div 之上显示一个相对于其大小的图像。是否可以在 div 上叠加图像?
这似乎是一个非常愚蠢的问题,但我似乎找不到任何这样做的例子。
提前致谢
CodePen http://codepen.io/anon/pen/wBNeVa
我的像素哥们的 CodePen http://codepen.io/anon/pen/KwJqON
HTML
<header>
<div class="container">
<!--Pixel Me Dude -->
<div class="b" id="navi"></div>
<div id="infoi"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/2000px-Smiley.svg.png" height="20" width="32"/>b</div>
</div>
</header>
CSS
#navi,
#infoi {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
#infoi {
z-index: 10;
}
/* Smartphones ----------- */
@media (min-width : 320px) and (max-width : 480px) {
.b {
font-size: 0.5px;
}
}
/* iPads ----------- */
@media (min-width : 480px) and (max-width : 1024px) {
.b {
font-size: 0.7px;
}
}
/* Desktops and laptops ----------- */
@media (min-width : 1024px) {
.b {
font-size: 1px;
}
}
/* Large screens ----------- */
@media (min-width : 1824px) {
.b {
font-size: 1.5px;
}
}
.b {
content:'';
position: absolute;
top: 35%;
left: 30%;
display: block;
box-sizing: border-box;
width: 11px;
height: 11px;
box-shadow: 0em 0em transparent, 0em 0em transparent, 11em 0em transparent, 22em 0em transparent, 33em 0em transparent, 44em 0em transparent, 55em 0em transparent, 66em 0em #3a3a3a, 77em 0em #000, 88em 0em #3a3a3a, 99em 0em #000, 110em 0em #000, 121em 0em #000, 132em 0em #000, 143em 0em transparent, 154em 0em transparent, 165em 0em transparent, 176em 0em transparent, 11em 11em transparent, 22em 11em transparent, 33em 11em transparent, 44em 11em transparent, 55em 11em #3a3a3a, 66em 11em #000, 77em 11em #3a3a3a, 88em 11em #000, 99em 11em #000, 110em 11em #000, 121em 11em #000, 132em 11em #000, 143em 11em #000, 154em 11em transparent, 165em 11em transparent, 176em 11em transparent, 187em 11em transparent, 11em 22em transparent, 22em 22em transparent, 33em 22em transparent, 44em 22em #3a3a3a, 55em 22em #000, 66em 22em #3a3a3a, 77em 22em #000, 88em 22em #000, 99em 22em #000, 110em 22em #000, 121em 22em #000, 132em 22em #000, 143em 22em #000, 154em 22em #000, 165em 22em transparent, 176em 22em transparent, 187em 22em transparent, 11em 33em transparent, 22em 33em transparent, 33em 33em #3a3a3a, 44em 33em #000, 55em 33em #3a3a3a, 66em 33em #000, 77em 33em #000, 88em 33em #000, 99em 33em #000, 110em 33em #000, 121em 33em #000, 132em 33em #000, 143em 33em #000, 154em 33em #000, 165em 33em #000, 176em 33em transparent, 187em 33em transparent, 11em 44em transparent, 22em 44em #3a3a3a, 33em 44em #000, 44em 44em #3a3a3a, 55em 44em #000, 66em 44em #000, 77em 44em #000, 88em 44em #000, 99em 44em #000, 110em 44em #000, 121em 44em #000, 132em 44em #000, 143em 44em #000, 154em 44em #000, 165em 44em #000, 176em 44em #000, 187em 44em transparent, 11em 55em transparent, 22em 55em #3a3a3a, 33em 55em #f5cbb6, 44em 55em #f5cbb6, 55em 55em #fadece, 66em 55em #fadece, 77em 55em #fadece, 88em 55em #fadece, 99em 55em #fadece, 110em 55em #fadece, 121em 55em #fadece, 132em 55em #fadece, 143em 55em #fadece, 154em 55em #fadece, 165em 55em #fadece, 176em 55em #000, 187em 55em transparent, 11em 66em transparent, 22em 66em #3a3a3a, 33em 66em #f5cbb6, 44em 66em #f5cbb6, 55em 66em #fadece, 66em 66em #fadece, 77em 66em #fadece, 88em 66em #fadece, 99em 66em #fadece, 110em 66em #fadece, 121em 66em #fadece, 132em 66em #fadece, 143em 66em #fadece, 154em 66em #fadece, 165em 66em #fadece, 176em 66em #000, 187em 66em transparent, 11em 77em transparent, 22em 77em #3a3a3a, 33em 77em #f5cbb6, 44em 77em #f5cbb6, 55em 77em #fadece, 66em 77em #fadece, 77em 77em #fadece, 88em 77em #fadece, 99em 77em #fadece, 110em 77em #fadece, 121em 77em #fadece, 132em 77em #fadece, 143em 77em #fadece, 154em 77em #fadece, 165em 77em #fadece, 176em 77em #000, 187em 77em transparent, 11em 88em transparent, 22em 88em #3a3a3a, 33em 88em #f5cbb6, 44em 88em #f5cbb6, 55em 88em #fadece, 66em 88em #fadece, 77em 88em #fadece, 88em 88em #fadece, 99em 88em #fadece, 110em 88em #fadece, 121em 88em #fadece, 132em 88em #fadece, 143em 88em #fadece, 154em 88em #fadece, 165em 88em #fadece, 176em 88em #000, 187em 88em transparent, 11em 99em transparent, 22em 99em #3a3a3a, 33em 99em #f5cbb6, 44em 99em #3a3a3a, 55em 99em #000, 66em 99em #000, 77em 99em #000, 88em 99em #fadece, 99em 99em #fadece, 110em 99em #fadece, 121em 99em #3a3a3a, 132em 99em #000, 143em 99em #000, 154em 99em #000, 165em 99em #fadece, 176em 99em #000, 187em 99em transparent, 11em 110em transparent, 22em 110em #3a3a3a, 33em 110em #f5cbb6, 44em 110em #fadece, 55em 110em #fadece, 66em 110em #3a3a3a, 77em 110em #fadece, 88em 110em #fadece, 99em 110em #f5cbb6, 110em 110em #fadece, 121em 110em #fadece, 132em 110em #3a3a3a, 143em 110em #fadece, 154em 110em #fadece, 165em 110em #fadece, 176em 110em #000, 187em 110em transparent, 11em 121em transparent, 22em 121em #fadece, 33em 121em #f5cbb6, 44em 121em #fadece, 55em 121em #fadece, 66em 121em #fadece, 77em 121em #fadece, 88em 121em #fadece, 99em 121em #f5cbb6, 110em 121em #fadece, 121em 121em #fadece, 132em 121em #fadece, 143em 121em #fadece, 154em 121em #fadece, 165em 121em #fadece, 176em 121em #f5cbb6, 187em 121em transparent, 11em 132em transparent, 22em 132em #fadece, 33em 132em #f5cbb6, 44em 132em #fadece, 55em 132em #fadece, 66em 132em #fadece, 77em 132em #fadece, 88em 132em #fadece, 99em 132em #f5cbb6, 110em 132em #fadece, 121em 132em #fadece, 132em 132em #fadece, 143em 132em #fadece, 154em 132em #fadece, 165em 132em #fadece, 176em 132em #f5cbb6, 187em 132em transparent, 11em 143em transparent, 22em 143em #fadece, 33em 143em #f5cbb6, 44em 143em #fadece, 55em 143em #fadece, 66em 143em #fadece, 77em 143em #fadece, 88em 143em #fadece, 99em 143em #f5cbb6, 110em 143em #fadece, 121em 143em #fadece, 132em 143em #fadece, 143em 143em #fadece, 154em 143em #fadece, 165em 143em #fadece, 176em 143em #f5cbb6, 187em 143em transparent, 11em 154em transparent, 22em 154em transparent, 33em 154em #f5cbb6, 44em 154em #fadece, 55em 154em #fadece, 66em 154em #fadece, 77em 154em #fadece, 88em 154em #f5cbb6, 99em 154em #f5cbb6, 110em 154em #f5cbb6, 121em 154em #fadece, 132em 154em #fadece, 143em 154em #fadece, 154em 154em #fadece, 165em 154em #fadece, 176em 154em transparent, 187em 154em transparent, 11em 165em transparent, 22em 165em transparent, 33em 165em #f5cbb6, 44em 165em #fadece, 55em 165em #fadece, 66em 165em #fadece, 77em 165em #3a3a3a, 88em 165em #3a3a3a, 99em 165em #3a3a3a, 110em 165em #3a3a3a, 121em 165em #3a3a3a, 132em 165em #fadece, 143em 165em #fadece, 154em 165em #fadece, 165em 165em #fadece, 176em 165em transparent, 187em 165em transparent, 11em 176em transparent, 22em 176em transparent, 33em 176em #f5cbb6, 44em 176em #fadece, 55em 176em #fadece, 66em 176em #3a3a3a, 77em 176em #3a3a3a, 88em 176em #3a3a3a, 99em 176em #3a3a3a, 110em 176em #3a3a3a, 121em 176em #3a3a3a, 132em 176em #3a3a3a, 143em 176em #fadece, 154em 176em #fadece, 165em 176em #fadece, 176em 176em transparent, 187em 176em transparent, 11em 187em transparent, 22em 187em transparent, 33em 187em #f5cbb6, 44em 187em #fadece, 55em 187em #fadece, 66em 187em #3a3a3a, 77em 187em transparent, 88em 187em transparent, 99em 187em transparent, 110em 187em transparent, 121em 187em transparent, 132em 187em #3a3a3a, 143em 187em #fadece, 154em 187em #fadece, 165em 187em #fadece, 176em 187em transparent, 187em 187em transparent, 11em 198em transparent, 22em 198em transparent, 33em 198em transparent, 44em 198em #e5ddd9, 55em 198em #e5ddd9, 66em 198em #3a3a3a, 77em 198em #e5ddd9, 88em 198em transparent, 99em 198em transparent, 110em 198em transparent, 121em 198em #e5ddd9, 132em 198em #3a3a3a, 143em 198em #e5ddd9, 154em 198em #e5ddd9, 165em 198em transparent, 176em 198em transparent, 187em 198em transparent, 11em 209em transparent, 22em 209em transparent, 33em 209em transparent, 44em 209em transparent, 55em 209em #e5ddd9, 66em 209em #3a3a3a, 77em 209em #e5ddd9, 88em 209em #3a3a3a, 99em 209em #3a3a3a, 110em 209em #3a3a3a, 121em 209em #e5ddd9, 132em 209em #3a3a3a, 143em 209em #e5ddd9, 154em 209em transparent, 165em 209em transparent, 176em 209em transparent, 187em 209em transparent, 11em 220em transparent, 22em 220em transparent, 33em 220em transparent, 44em 220em transparent, 55em 220em transparent, 66em 220em #3a3a3a, 77em 220em #3a3a3a, 88em 220em #3a3a3a, 99em 220em #3a3a3a, 110em 220em #3a3a3a, 121em 220em #3a3a3a, 132em 220em #3a3a3a, 143em 220em transparent, 154em 220em transparent, 165em 220em transparent, 176em 220em transparent, 187em 220em transparent, 11em 231em transparent, 22em 231em transparent, 33em 231em transparent, 44em 231em transparent, 55em 231em transparent, 66em 231em transparent, 77em 231em #f5cbb6, 88em 231em #fadece, 99em 231em #fadece, 110em 231em #fadece, 121em 231em #fadece, 132em 231em transparent, 143em 231em transparent, 154em 231em transparent, 165em 231em transparent, 176em 231em transparent, 187em 231em transparent, 11em 242em transparent, 22em 242em transparent, 33em 242em transparent, 44em 242em transparent, 55em 242em transparent, 66em 242em #19689d, 77em 242em #f5cbb6, 88em 242em #fadece, 99em 242em #fadece, 110em 242em #fadece, 121em 242em #fadece, 132em 242em #0f75bc, 143em 242em transparent, 154em 242em transparent, 165em 242em transparent, 176em 242em transparent, 187em 242em transparent, 11em 253em transparent, 22em 253em transparent, 33em 253em transparent, 44em 253em transparent, 55em 253em transparent, 66em 253em #19689d, 77em 253em #f5cbb6, 88em 253em #fadece, 99em 253em #fadece, 110em 253em #fadece, 121em 253em #fadece, 132em 253em #0f75bc, 143em 253em transparent, 154em 253em transparent, 165em 253em transparent, 176em 253em transparent, 187em 253em transparent, 11em 264em #19689d, 22em 264em #19689d, 33em 264em #19689d, 44em 264em #19689d, 55em 264em #19689d, 66em 264em #19689d, 77em 264em #19689d, 88em 264em #fadece, 99em 264em #fadece, 110em 264em #fadece, 121em 264em #0f75bc, 132em 264em #0f75bc, 143em 264em #0f75bc, 154em 264em #0f75bc, 165em 264em #0f75bc, 176em 264em #0f75bc, 187em 264em #0f75bc, 11em 275em #19689d, 22em 275em #0f75bc, 33em 275em #0f75bc, 44em 275em #0f75bc, 55em 275em #0f75bc, 66em 275em #0f75bc, 77em 275em #0f75bc, 88em 275em #0f75bc, 99em 275em #19689d, 110em 275em #0f75bc, 121em 275em #0f75bc, 132em 275em #0f75bc, 143em 275em #0f75bc, 154em 275em #0f75bc, 165em 275em #0f75bc, 176em 275em #0f75bc, 187em 275em #0f75bc, 11em 286em #19689d, 22em 286em #0f75bc, 33em 286em #0f75bc, 44em 286em #0f75bc, 55em 286em #0f75bc, 66em 286em #0f75bc, 77em 286em #0f75bc, 88em 286em #0f75bc, 99em 286em #0f75bc, 110em 286em #0f75bc, 121em 286em #0f75bc, 132em 286em #0f75bc, 143em 286em #0f75bc, 154em 286em #0f75bc, 165em 286em #0f75bc, 176em 286em #0f75bc, 187em 286em #0f75bc, 11em 297em #19689d, 22em 297em #0f75bc, 33em 297em #0f75bc, 44em 297em #0f75bc, 55em 297em #0f75bc, 66em 297em #0f75bc, 77em 297em #0f75bc, 88em 297em #0f75bc, 99em 297em #19689d, 110em 297em #0f75bc, 121em 297em #0f75bc, 132em 297em #0f75bc, 143em 297em #0f75bc, 154em 297em #0f75bc, 165em 297em #0f75bc, 176em 297em #0f75bc, 187em 297em #0f75bc;
}
因为您的图片是由 box-shadow
制作的,我发现这是最好的解决方案。您需要将 DIV 元素与 class b 包裹在另一个 DIV 中,然后简单地应用您需要的定位。如果有更有效的方法,我们深表歉意。这允许您将所有内容保存在 CSS.
中
.container{
position:relative;
width:212px;
height:308px;
}
.container:hover:before {
position:relative;
z-index:2;
content:"";
top:0;
bottom:0;
left:0;
right:0;
background:url('http://masterherald.com/wp-content/uploads/2014/11/Bitcoin-Prices.png');
background-size:212px 308px;
display:block;
width:212px;
height:308px;
}
.b {
content:'';
position: absolute;
top: 0%;
left: 0%;
display:block;
width: 11px;
height: 11px;
box-shadow: 0em 0em transparent, 0em 0em transparent, 11em 0em transparent, 22em 0em transparent, 33em 0em transparent, 44em 0em transparent, 55em 0em transparent, 66em 0em #3a3a3a, 77em 0em #000, 88em 0em #3a3a3a, 99em 0em #000, 110em 0em #000, 121em 0em #000, 132em 0em #000, 143em 0em transparent, 154em 0em transparent, 165em 0em transparent, 176em 0em transparent, 11em 11em transparent, 22em 11em transparent, 33em 11em transparent, 44em 11em transparent, 55em 11em #3a3a3a, 66em 11em #000, 77em 11em #3a3a3a, 88em 11em #000, 99em 11em #000, 110em 11em #000, 121em 11em #000, 132em 11em #000, 143em 11em #000, 154em 11em transparent, 165em 11em transparent, 176em 11em transparent, 187em 11em transparent, 11em 22em transparent, 22em 22em transparent, 33em 22em transparent, 44em 22em #3a3a3a, 55em 22em #000, 66em 22em #3a3a3a, 77em 22em #000, 88em 22em #000, 99em 22em #000, 110em 22em #000, 121em 22em #000, 132em 22em #000, 143em 22em #000, 154em 22em #000, 165em 22em transparent, 176em 22em transparent, 187em 22em transparent, 11em 33em transparent, 22em 33em transparent, 33em 33em #3a3a3a, 44em 33em #000, 55em 33em #3a3a3a, 66em 33em #000, 77em 33em #000, 88em 33em #000, 99em 33em #000, 110em 33em #000, 121em 33em #000, 132em 33em #000, 143em 33em #000, 154em 33em #000, 165em 33em #000, 176em 33em transparent, 187em 33em transparent, 11em 44em transparent, 22em 44em #3a3a3a, 33em 44em #000, 44em 44em #3a3a3a, 55em 44em #000, 66em 44em #000, 77em 44em #000, 88em 44em #000, 99em 44em #000, 110em 44em #000, 121em 44em #000, 132em 44em #000, 143em 44em #000, 154em 44em #000, 165em 44em #000, 176em 44em #000, 187em 44em transparent, 11em 55em transparent, 22em 55em #3a3a3a, 33em 55em #f5cbb6, 44em 55em #f5cbb6, 55em 55em #fadece, 66em 55em #fadece, 77em 55em #fadece, 88em 55em #fadece, 99em 55em #fadece, 110em 55em #fadece, 121em 55em #fadece, 132em 55em #fadece, 143em 55em #fadece, 154em 55em #fadece, 165em 55em #fadece, 176em 55em #000, 187em 55em transparent, 11em 66em transparent, 22em 66em #3a3a3a, 33em 66em #f5cbb6, 44em 66em #f5cbb6, 55em 66em #fadece, 66em 66em #fadece, 77em 66em #fadece, 88em 66em #fadece, 99em 66em #fadece, 110em 66em #fadece, 121em 66em #fadece, 132em 66em #fadece, 143em 66em #fadece, 154em 66em #fadece, 165em 66em #fadece, 176em 66em #000, 187em 66em transparent, 11em 77em transparent, 22em 77em #3a3a3a, 33em 77em #f5cbb6, 44em 77em #f5cbb6, 55em 77em #fadece, 66em 77em #fadece, 77em 77em #fadece, 88em 77em #fadece, 99em 77em #fadece, 110em 77em #fadece, 121em 77em #fadece, 132em 77em #fadece, 143em 77em #fadece, 154em 77em #fadece, 165em 77em #fadece, 176em 77em #000, 187em 77em transparent, 11em 88em transparent, 22em 88em #3a3a3a, 33em 88em #f5cbb6, 44em 88em #f5cbb6, 55em 88em #fadece, 66em 88em #fadece, 77em 88em #fadece, 88em 88em #fadece, 99em 88em #fadece, 110em 88em #fadece, 121em 88em #fadece, 132em 88em #fadece, 143em 88em #fadece, 154em 88em #fadece, 165em 88em #fadece, 176em 88em #000, 187em 88em transparent, 11em 99em transparent, 22em 99em #3a3a3a, 33em 99em #f5cbb6, 44em 99em #3a3a3a, 55em 99em #000, 66em 99em #000, 77em 99em #000, 88em 99em #fadece, 99em 99em #fadece, 110em 99em #fadece, 121em 99em #3a3a3a, 132em 99em #000, 143em 99em #000, 154em 99em #000, 165em 99em #fadece, 176em 99em #000, 187em 99em transparent, 11em 110em transparent, 22em 110em #3a3a3a, 33em 110em #f5cbb6, 44em 110em #fadece, 55em 110em #fadece, 66em 110em #3a3a3a, 77em 110em #fadece, 88em 110em #fadece, 99em 110em #f5cbb6, 110em 110em #fadece, 121em 110em #fadece, 132em 110em #3a3a3a, 143em 110em #fadece, 154em 110em #fadece, 165em 110em #fadece, 176em 110em #000, 187em 110em transparent, 11em 121em transparent, 22em 121em #fadece, 33em 121em #f5cbb6, 44em 121em #fadece, 55em 121em #fadece, 66em 121em #fadece, 77em 121em #fadece, 88em 121em #fadece, 99em 121em #f5cbb6, 110em 121em #fadece, 121em 121em #fadece, 132em 121em #fadece, 143em 121em #fadece, 154em 121em #fadece, 165em 121em #fadece, 176em 121em #f5cbb6, 187em 121em transparent, 11em 132em transparent, 22em 132em #fadece, 33em 132em #f5cbb6, 44em 132em #fadece, 55em 132em #fadece, 66em 132em #fadece, 77em 132em #fadece, 88em 132em #fadece, 99em 132em #f5cbb6, 110em 132em #fadece, 121em 132em #fadece, 132em 132em #fadece, 143em 132em #fadece, 154em 132em #fadece, 165em 132em #fadece, 176em 132em #f5cbb6, 187em 132em transparent, 11em 143em transparent, 22em 143em #fadece, 33em 143em #f5cbb6, 44em 143em #fadece, 55em 143em #fadece, 66em 143em #fadece, 77em 143em #fadece, 88em 143em #fadece, 99em 143em #f5cbb6, 110em 143em #fadece, 121em 143em #fadece, 132em 143em #fadece, 143em 143em #fadece, 154em 143em #fadece, 165em 143em #fadece, 176em 143em #f5cbb6, 187em 143em transparent, 11em 154em transparent, 22em 154em transparent, 33em 154em #f5cbb6, 44em 154em #fadece, 55em 154em #fadece, 66em 154em #fadece, 77em 154em #fadece, 88em 154em #f5cbb6, 99em 154em #f5cbb6, 110em 154em #f5cbb6, 121em 154em #fadece, 132em 154em #fadece, 143em 154em #fadece, 154em 154em #fadece, 165em 154em #fadece, 176em 154em transparent, 187em 154em transparent, 11em 165em transparent, 22em 165em transparent, 33em 165em #f5cbb6, 44em 165em #fadece, 55em 165em #fadece, 66em 165em #fadece, 77em 165em #3a3a3a, 88em 165em #3a3a3a, 99em 165em #3a3a3a, 110em 165em #3a3a3a, 121em 165em #3a3a3a, 132em 165em #fadece, 143em 165em #fadece, 154em 165em #fadece, 165em 165em #fadece, 176em 165em transparent, 187em 165em transparent, 11em 176em transparent, 22em 176em transparent, 33em 176em #f5cbb6, 44em 176em #fadece, 55em 176em #fadece, 66em 176em #3a3a3a, 77em 176em #3a3a3a, 88em 176em #3a3a3a, 99em 176em #3a3a3a, 110em 176em #3a3a3a, 121em 176em #3a3a3a, 132em 176em #3a3a3a, 143em 176em #fadece, 154em 176em #fadece, 165em 176em #fadece, 176em 176em transparent, 187em 176em transparent, 11em 187em transparent, 22em 187em transparent, 33em 187em #f5cbb6, 44em 187em #fadece, 55em 187em #fadece, 66em 187em #3a3a3a, 77em 187em transparent, 88em 187em transparent, 99em 187em transparent, 110em 187em transparent, 121em 187em transparent, 132em 187em #3a3a3a, 143em 187em #fadece, 154em 187em #fadece, 165em 187em #fadece, 176em 187em transparent, 187em 187em transparent, 11em 198em transparent, 22em 198em transparent, 33em 198em transparent, 44em 198em #e5ddd9, 55em 198em #e5ddd9, 66em 198em #3a3a3a, 77em 198em #e5ddd9, 88em 198em transparent, 99em 198em transparent, 110em 198em transparent, 121em 198em #e5ddd9, 132em 198em #3a3a3a, 143em 198em #e5ddd9, 154em 198em #e5ddd9, 165em 198em transparent, 176em 198em transparent, 187em 198em transparent, 11em 209em transparent, 22em 209em transparent, 33em 209em transparent, 44em 209em transparent, 55em 209em #e5ddd9, 66em 209em #3a3a3a, 77em 209em #e5ddd9, 88em 209em #3a3a3a, 99em 209em #3a3a3a, 110em 209em #3a3a3a, 121em 209em #e5ddd9, 132em 209em #3a3a3a, 143em 209em #e5ddd9, 154em 209em transparent, 165em 209em transparent, 176em 209em transparent, 187em 209em transparent, 11em 220em transparent, 22em 220em transparent, 33em 220em transparent, 44em 220em transparent, 55em 220em transparent, 66em 220em #3a3a3a, 77em 220em #3a3a3a, 88em 220em #3a3a3a, 99em 220em #3a3a3a, 110em 220em #3a3a3a, 121em 220em #3a3a3a, 132em 220em #3a3a3a, 143em 220em transparent, 154em 220em transparent, 165em 220em transparent, 176em 220em transparent, 187em 220em transparent, 11em 231em transparent, 22em 231em transparent, 33em 231em transparent, 44em 231em transparent, 55em 231em transparent, 66em 231em transparent, 77em 231em #f5cbb6, 88em 231em #fadece, 99em 231em #fadece, 110em 231em #fadece, 121em 231em #fadece, 132em 231em transparent, 143em 231em transparent, 154em 231em transparent, 165em 231em transparent, 176em 231em transparent, 187em 231em transparent, 11em 242em transparent, 22em 242em transparent, 33em 242em transparent, 44em 242em transparent, 55em 242em transparent, 66em 242em #19689d, 77em 242em #f5cbb6, 88em 242em #fadece, 99em 242em #fadece, 110em 242em #fadece, 121em 242em #fadece, 132em 242em #0f75bc, 143em 242em transparent, 154em 242em transparent, 165em 242em transparent, 176em 242em transparent, 187em 242em transparent, 11em 253em transparent, 22em 253em transparent, 33em 253em transparent, 44em 253em transparent, 55em 253em transparent, 66em 253em #19689d, 77em 253em #f5cbb6, 88em 253em #fadece, 99em 253em #fadece, 110em 253em #fadece, 121em 253em #fadece, 132em 253em #0f75bc, 143em 253em transparent, 154em 253em transparent, 165em 253em transparent, 176em 253em transparent, 187em 253em transparent, 11em 264em #19689d, 22em 264em #19689d, 33em 264em #19689d, 44em 264em #19689d, 55em 264em #19689d, 66em 264em #19689d, 77em 264em #19689d, 88em 264em #fadece, 99em 264em #fadece, 110em 264em #fadece, 121em 264em #0f75bc, 132em 264em #0f75bc, 143em 264em #0f75bc, 154em 264em #0f75bc, 165em 264em #0f75bc, 176em 264em #0f75bc, 187em 264em #0f75bc, 11em 275em #19689d, 22em 275em #0f75bc, 33em 275em #0f75bc, 44em 275em #0f75bc, 55em 275em #0f75bc, 66em 275em #0f75bc, 77em 275em #0f75bc, 88em 275em #0f75bc, 99em 275em #19689d, 110em 275em #0f75bc, 121em 275em #0f75bc, 132em 275em #0f75bc, 143em 275em #0f75bc, 154em 275em #0f75bc, 165em 275em #0f75bc, 176em 275em #0f75bc, 187em 275em #0f75bc, 11em 286em #19689d, 22em 286em #0f75bc, 33em 286em #0f75bc, 44em 286em #0f75bc, 55em 286em #0f75bc, 66em 286em #0f75bc, 77em 286em #0f75bc, 88em 286em #0f75bc, 99em 286em #0f75bc, 110em 286em #0f75bc, 121em 286em #0f75bc, 132em 286em #0f75bc, 143em 286em #0f75bc, 154em 286em #0f75bc, 165em 286em #0f75bc, 176em 286em #0f75bc, 187em 286em #0f75bc, 11em 297em #19689d, 22em 297em #0f75bc, 33em 297em #0f75bc, 44em 297em #0f75bc, 55em 297em #0f75bc, 66em 297em #0f75bc, 77em 297em #0f75bc, 88em 297em #0f75bc, 99em 297em #19689d, 110em 297em #0f75bc, 121em 297em #0f75bc, 132em 297em #0f75bc, 143em 297em #0f75bc, 154em 297em #0f75bc, 165em 297em #0f75bc, 176em 297em #0f75bc, 187em 297em #0f75bc;
}
如果你使用 font-size 来调整 .b
的大小,那么 #infoi
也一样
http://codepen.io/anon/pen/OPdjzX
.container {
position: relative;
display: block;
width: 300px;
height: 500px;
}
.b {
position: absolute;
top: 0;
left: 0;
}
#infoi b {
font-size:25em;
}
#infoi {
position: absolute;
left: 25em;
top: 45em;
height:182.5em;
width:160em;
}
#infoi img {
height:100%;
width:100%;
}
.container #infoi {
opacity: 0;
transition: opacity 0.5s;
}
.container:hover #infoi {
opacity: 1;
}
/* Smartphones ----------- */
@media (min-width : 320px) and (max-width : 480px) {
.b, #infoi {
font-size: 0.5px;
}
}
/* iPads ----------- */
@media (min-width : 480px) and (max-width : 1024px) {
.b, #infoi {
font-size: 0.7px;
}
}
/* Desktops and laptops ----------- */
@media (min-width : 1024px) {
.b, #infoi {
font-size: 1px;
}
}
/* Large screens ----------- */
@media (min-width : 1824px) {
.b, #infoi {
font-size: 1.5px;
}
}
.b {
content:'';
position: absolute;
display: block;
box-sizing: border-box;
width: 11px;
height: 11px;
box-shadow: 0em 0em transparent, 0em 0em transparent, 11em 0em transparent, 22em 0em transparent, 33em 0em transparent, 44em 0em transparent, 55em 0em transparent, 66em 0em #3a3a3a, 77em 0em #000, 88em 0em #3a3a3a, 99em 0em #000, 110em 0em #000, 121em 0em #000, 132em 0em #000, 143em 0em transparent, 154em 0em transparent, 165em 0em transparent, 176em 0em transparent, 11em 11em transparent, 22em 11em transparent, 33em 11em transparent, 44em 11em transparent, 55em 11em #3a3a3a, 66em 11em #000, 77em 11em #3a3a3a, 88em 11em #000, 99em 11em #000, 110em 11em #000, 121em 11em #000, 132em 11em #000, 143em 11em #000, 154em 11em transparent, 165em 11em transparent, 176em 11em transparent, 187em 11em transparent, 11em 22em transparent, 22em 22em transparent, 33em 22em transparent, 44em 22em #3a3a3a, 55em 22em #000, 66em 22em #3a3a3a, 77em 22em #000, 88em 22em #000, 99em 22em #000, 110em 22em #000, 121em 22em #000, 132em 22em #000, 143em 22em #000, 154em 22em #000, 165em 22em transparent, 176em 22em transparent, 187em 22em transparent, 11em 33em transparent, 22em 33em transparent, 33em 33em #3a3a3a, 44em 33em #000, 55em 33em #3a3a3a, 66em 33em #000, 77em 33em #000, 88em 33em #000, 99em 33em #000, 110em 33em #000, 121em 33em #000, 132em 33em #000, 143em 33em #000, 154em 33em #000, 165em 33em #000, 176em 33em transparent, 187em 33em transparent, 11em 44em transparent, 22em 44em #3a3a3a, 33em 44em #000, 44em 44em #3a3a3a, 55em 44em #000, 66em 44em #000, 77em 44em #000, 88em 44em #000, 99em 44em #000, 110em 44em #000, 121em 44em #000, 132em 44em #000, 143em 44em #000, 154em 44em #000, 165em 44em #000, 176em 44em #000, 187em 44em transparent, 11em 55em transparent, 22em 55em #3a3a3a, 33em 55em #f5cbb6, 44em 55em #f5cbb6, 55em 55em #fadece, 66em 55em #fadece, 77em 55em #fadece, 88em 55em #fadece, 99em 55em #fadece, 110em 55em #fadece, 121em 55em #fadece, 132em 55em #fadece, 143em 55em #fadece, 154em 55em #fadece, 165em 55em #fadece, 176em 55em #000, 187em 55em transparent, 11em 66em transparent, 22em 66em #3a3a3a, 33em 66em #f5cbb6, 44em 66em #f5cbb6, 55em 66em #fadece, 66em 66em #fadece, 77em 66em #fadece, 88em 66em #fadece, 99em 66em #fadece, 110em 66em #fadece, 121em 66em #fadece, 132em 66em #fadece, 143em 66em #fadece, 154em 66em #fadece, 165em 66em #fadece, 176em 66em #000, 187em 66em transparent, 11em 77em transparent, 22em 77em #3a3a3a, 33em 77em #f5cbb6, 44em 77em #f5cbb6, 55em 77em #fadece, 66em 77em #fadece, 77em 77em #fadece, 88em 77em #fadece, 99em 77em #fadece, 110em 77em #fadece, 121em 77em #fadece, 132em 77em #fadece, 143em 77em #fadece, 154em 77em #fadece, 165em 77em #fadece, 176em 77em #000, 187em 77em transparent, 11em 88em transparent, 22em 88em #3a3a3a, 33em 88em #f5cbb6, 44em 88em #f5cbb6, 55em 88em #fadece, 66em 88em #fadece, 77em 88em #fadece, 88em 88em #fadece, 99em 88em #fadece, 110em 88em #fadece, 121em 88em #fadece, 132em 88em #fadece, 143em 88em #fadece, 154em 88em #fadece, 165em 88em #fadece, 176em 88em #000, 187em 88em transparent, 11em 99em transparent, 22em 99em #3a3a3a, 33em 99em #f5cbb6, 44em 99em #3a3a3a, 55em 99em #000, 66em 99em #000, 77em 99em #000, 88em 99em #fadece, 99em 99em #fadece, 110em 99em #fadece, 121em 99em #3a3a3a, 132em 99em #000, 143em 99em #000, 154em 99em #000, 165em 99em #fadece, 176em 99em #000, 187em 99em transparent, 11em 110em transparent, 22em 110em #3a3a3a, 33em 110em #f5cbb6, 44em 110em #fadece, 55em 110em #fadece, 66em 110em #3a3a3a, 77em 110em #fadece, 88em 110em #fadece, 99em 110em #f5cbb6, 110em 110em #fadece, 121em 110em #fadece, 132em 110em #3a3a3a, 143em 110em #fadece, 154em 110em #fadece, 165em 110em #fadece, 176em 110em #000, 187em 110em transparent, 11em 121em transparent, 22em 121em #fadece, 33em 121em #f5cbb6, 44em 121em #fadece, 55em 121em #fadece, 66em 121em #fadece, 77em 121em #fadece, 88em 121em #fadece, 99em 121em #f5cbb6, 110em 121em #fadece, 121em 121em #fadece, 132em 121em #fadece, 143em 121em #fadece, 154em 121em #fadece, 165em 121em #fadece, 176em 121em #f5cbb6, 187em 121em transparent, 11em 132em transparent, 22em 132em #fadece, 33em 132em #f5cbb6, 44em 132em #fadece, 55em 132em #fadece, 66em 132em #fadece, 77em 132em #fadece, 88em 132em #fadece, 99em 132em #f5cbb6, 110em 132em #fadece, 121em 132em #fadece, 132em 132em #fadece, 143em 132em #fadece, 154em 132em #fadece, 165em 132em #fadece, 176em 132em #f5cbb6, 187em 132em transparent, 11em 143em transparent, 22em 143em #fadece, 33em 143em #f5cbb6, 44em 143em #fadece, 55em 143em #fadece, 66em 143em #fadece, 77em 143em #fadece, 88em 143em #fadece, 99em 143em #f5cbb6, 110em 143em #fadece, 121em 143em #fadece, 132em 143em #fadece, 143em 143em #fadece, 154em 143em #fadece, 165em 143em #fadece, 176em 143em #f5cbb6, 187em 143em transparent, 11em 154em transparent, 22em 154em transparent, 33em 154em #f5cbb6, 44em 154em #fadece, 55em 154em #fadece, 66em 154em #fadece, 77em 154em #fadece, 88em 154em #f5cbb6, 99em 154em #f5cbb6, 110em 154em #f5cbb6, 121em 154em #fadece, 132em 154em #fadece, 143em 154em #fadece, 154em 154em #fadece, 165em 154em #fadece, 176em 154em transparent, 187em 154em transparent, 11em 165em transparent, 22em 165em transparent, 33em 165em #f5cbb6, 44em 165em #fadece, 55em 165em #fadece, 66em 165em #fadece, 77em 165em #3a3a3a, 88em 165em #3a3a3a, 99em 165em #3a3a3a, 110em 165em #3a3a3a, 121em 165em #3a3a3a, 132em 165em #fadece, 143em 165em #fadece, 154em 165em #fadece, 165em 165em #fadece, 176em 165em transparent, 187em 165em transparent, 11em 176em transparent, 22em 176em transparent, 33em 176em #f5cbb6, 44em 176em #fadece, 55em 176em #fadece, 66em 176em #3a3a3a, 77em 176em #3a3a3a, 88em 176em #3a3a3a, 99em 176em #3a3a3a, 110em 176em #3a3a3a, 121em 176em #3a3a3a, 132em 176em #3a3a3a, 143em 176em #fadece, 154em 176em #fadece, 165em 176em #fadece, 176em 176em transparent, 187em 176em transparent, 11em 187em transparent, 22em 187em transparent, 33em 187em #f5cbb6, 44em 187em #fadece, 55em 187em #fadece, 66em 187em #3a3a3a, 77em 187em transparent, 88em 187em transparent, 99em 187em transparent, 110em 187em transparent, 121em 187em transparent, 132em 187em #3a3a3a, 143em 187em #fadece, 154em 187em #fadece, 165em 187em #fadece, 176em 187em transparent, 187em 187em transparent, 11em 198em transparent, 22em 198em transparent, 33em 198em transparent, 44em 198em #e5ddd9, 55em 198em #e5ddd9, 66em 198em #3a3a3a, 77em 198em #e5ddd9, 88em 198em transparent, 99em 198em transparent, 110em 198em transparent, 121em 198em #e5ddd9, 132em 198em #3a3a3a, 143em 198em #e5ddd9, 154em 198em #e5ddd9, 165em 198em transparent, 176em 198em transparent, 187em 198em transparent, 11em 209em transparent, 22em 209em transparent, 33em 209em transparent, 44em 209em transparent, 55em 209em #e5ddd9, 66em 209em #3a3a3a, 77em 209em #e5ddd9, 88em 209em #3a3a3a, 99em 209em #3a3a3a, 110em 209em #3a3a3a, 121em 209em #e5ddd9, 132em 209em #3a3a3a, 143em 209em #e5ddd9, 154em 209em transparent, 165em 209em transparent, 176em 209em transparent, 187em 209em transparent, 11em 220em transparent, 22em 220em transparent, 33em 220em transparent, 44em 220em transparent, 55em 220em transparent, 66em 220em #3a3a3a, 77em 220em #3a3a3a, 88em 220em #3a3a3a, 99em 220em #3a3a3a, 110em 220em #3a3a3a, 121em 220em #3a3a3a, 132em 220em #3a3a3a, 143em 220em transparent, 154em 220em transparent, 165em 220em transparent, 176em 220em transparent, 187em 220em transparent, 11em 231em transparent, 22em 231em transparent, 33em 231em transparent, 44em 231em transparent, 55em 231em transparent, 66em 231em transparent, 77em 231em #f5cbb6, 88em 231em #fadece, 99em 231em #fadece, 110em 231em #fadece, 121em 231em #fadece, 132em 231em transparent, 143em 231em transparent, 154em 231em transparent, 165em 231em transparent, 176em 231em transparent, 187em 231em transparent, 11em 242em transparent, 22em 242em transparent, 33em 242em transparent, 44em 242em transparent, 55em 242em transparent, 66em 242em #19689d, 77em 242em #f5cbb6, 88em 242em #fadece, 99em 242em #fadece, 110em 242em #fadece, 121em 242em #fadece, 132em 242em #0f75bc, 143em 242em transparent, 154em 242em transparent, 165em 242em transparent, 176em 242em transparent, 187em 242em transparent, 11em 253em transparent, 22em 253em transparent, 33em 253em transparent, 44em 253em transparent, 55em 253em transparent, 66em 253em #19689d, 77em 253em #f5cbb6, 88em 253em #fadece, 99em 253em #fadece, 110em 253em #fadece, 121em 253em #fadece, 132em 253em #0f75bc, 143em 253em transparent, 154em 253em transparent, 165em 253em transparent, 176em 253em transparent, 187em 253em transparent, 11em 264em #19689d, 22em 264em #19689d, 33em 264em #19689d, 44em 264em #19689d, 55em 264em #19689d, 66em 264em #19689d, 77em 264em #19689d, 88em 264em #fadece, 99em 264em #fadece, 110em 264em #fadece, 121em 264em #0f75bc, 132em 264em #0f75bc, 143em 264em #0f75bc, 154em 264em #0f75bc, 165em 264em #0f75bc, 176em 264em #0f75bc, 187em 264em #0f75bc, 11em 275em #19689d, 22em 275em #0f75bc, 33em 275em #0f75bc, 44em 275em #0f75bc, 55em 275em #0f75bc, 66em 275em #0f75bc, 77em 275em #0f75bc, 88em 275em #0f75bc, 99em 275em #19689d, 110em 275em #0f75bc, 121em 275em #0f75bc, 132em 275em #0f75bc, 143em 275em #0f75bc, 154em 275em #0f75bc, 165em 275em #0f75bc, 176em 275em #0f75bc, 187em 275em #0f75bc, 11em 286em #19689d, 22em 286em #0f75bc, 33em 286em #0f75bc, 44em 286em #0f75bc, 55em 286em #0f75bc, 66em 286em #0f75bc, 77em 286em #0f75bc, 88em 286em #0f75bc, 99em 286em #0f75bc, 110em 286em #0f75bc, 121em 286em #0f75bc, 132em 286em #0f75bc, 143em 286em #0f75bc, 154em 286em #0f75bc, 165em 286em #0f75bc, 176em 286em #0f75bc, 187em 286em #0f75bc, 11em 297em #19689d, 22em 297em #0f75bc, 33em 297em #0f75bc, 44em 297em #0f75bc, 55em 297em #0f75bc, 66em 297em #0f75bc, 77em 297em #0f75bc, 88em 297em #0f75bc, 99em 297em #19689d, 110em 297em #0f75bc, 121em 297em #0f75bc, 132em 297em #0f75bc, 143em 297em #0f75bc, 154em 297em #0f75bc, 165em 297em #0f75bc, 176em 297em #0f75bc, 187em 297em #0f75bc;
}
<header>
<div class="container clearfix">
<!--Pixel Me Dude -->
<div class="b"></div>
<div id="infoi"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/2000px-Smiley.svg.png" /><b>blop bla bla</b></div>
</div>
</header>
您需要调整左侧、顶部的高度和宽度以完全覆盖您想要的区域:)
我在 css 中绘制了一个小的像素化字符。此字符位于名为 b 的 div 元素中。当我将鼠标悬停在 div 上时,我想在 div 之上显示一个相对于其大小的图像。是否可以在 div 上叠加图像?
这似乎是一个非常愚蠢的问题,但我似乎找不到任何这样做的例子。
提前致谢
CodePen http://codepen.io/anon/pen/wBNeVa
我的像素哥们的 CodePen http://codepen.io/anon/pen/KwJqON
HTML
<header>
<div class="container">
<!--Pixel Me Dude -->
<div class="b" id="navi"></div>
<div id="infoi"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/2000px-Smiley.svg.png" height="20" width="32"/>b</div>
</div>
</header>
CSS
#navi,
#infoi {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
#infoi {
z-index: 10;
}
/* Smartphones ----------- */
@media (min-width : 320px) and (max-width : 480px) {
.b {
font-size: 0.5px;
}
}
/* iPads ----------- */
@media (min-width : 480px) and (max-width : 1024px) {
.b {
font-size: 0.7px;
}
}
/* Desktops and laptops ----------- */
@media (min-width : 1024px) {
.b {
font-size: 1px;
}
}
/* Large screens ----------- */
@media (min-width : 1824px) {
.b {
font-size: 1.5px;
}
}
.b {
content:'';
position: absolute;
top: 35%;
left: 30%;
display: block;
box-sizing: border-box;
width: 11px;
height: 11px;
box-shadow: 0em 0em transparent, 0em 0em transparent, 11em 0em transparent, 22em 0em transparent, 33em 0em transparent, 44em 0em transparent, 55em 0em transparent, 66em 0em #3a3a3a, 77em 0em #000, 88em 0em #3a3a3a, 99em 0em #000, 110em 0em #000, 121em 0em #000, 132em 0em #000, 143em 0em transparent, 154em 0em transparent, 165em 0em transparent, 176em 0em transparent, 11em 11em transparent, 22em 11em transparent, 33em 11em transparent, 44em 11em transparent, 55em 11em #3a3a3a, 66em 11em #000, 77em 11em #3a3a3a, 88em 11em #000, 99em 11em #000, 110em 11em #000, 121em 11em #000, 132em 11em #000, 143em 11em #000, 154em 11em transparent, 165em 11em transparent, 176em 11em transparent, 187em 11em transparent, 11em 22em transparent, 22em 22em transparent, 33em 22em transparent, 44em 22em #3a3a3a, 55em 22em #000, 66em 22em #3a3a3a, 77em 22em #000, 88em 22em #000, 99em 22em #000, 110em 22em #000, 121em 22em #000, 132em 22em #000, 143em 22em #000, 154em 22em #000, 165em 22em transparent, 176em 22em transparent, 187em 22em transparent, 11em 33em transparent, 22em 33em transparent, 33em 33em #3a3a3a, 44em 33em #000, 55em 33em #3a3a3a, 66em 33em #000, 77em 33em #000, 88em 33em #000, 99em 33em #000, 110em 33em #000, 121em 33em #000, 132em 33em #000, 143em 33em #000, 154em 33em #000, 165em 33em #000, 176em 33em transparent, 187em 33em transparent, 11em 44em transparent, 22em 44em #3a3a3a, 33em 44em #000, 44em 44em #3a3a3a, 55em 44em #000, 66em 44em #000, 77em 44em #000, 88em 44em #000, 99em 44em #000, 110em 44em #000, 121em 44em #000, 132em 44em #000, 143em 44em #000, 154em 44em #000, 165em 44em #000, 176em 44em #000, 187em 44em transparent, 11em 55em transparent, 22em 55em #3a3a3a, 33em 55em #f5cbb6, 44em 55em #f5cbb6, 55em 55em #fadece, 66em 55em #fadece, 77em 55em #fadece, 88em 55em #fadece, 99em 55em #fadece, 110em 55em #fadece, 121em 55em #fadece, 132em 55em #fadece, 143em 55em #fadece, 154em 55em #fadece, 165em 55em #fadece, 176em 55em #000, 187em 55em transparent, 11em 66em transparent, 22em 66em #3a3a3a, 33em 66em #f5cbb6, 44em 66em #f5cbb6, 55em 66em #fadece, 66em 66em #fadece, 77em 66em #fadece, 88em 66em #fadece, 99em 66em #fadece, 110em 66em #fadece, 121em 66em #fadece, 132em 66em #fadece, 143em 66em #fadece, 154em 66em #fadece, 165em 66em #fadece, 176em 66em #000, 187em 66em transparent, 11em 77em transparent, 22em 77em #3a3a3a, 33em 77em #f5cbb6, 44em 77em #f5cbb6, 55em 77em #fadece, 66em 77em #fadece, 77em 77em #fadece, 88em 77em #fadece, 99em 77em #fadece, 110em 77em #fadece, 121em 77em #fadece, 132em 77em #fadece, 143em 77em #fadece, 154em 77em #fadece, 165em 77em #fadece, 176em 77em #000, 187em 77em transparent, 11em 88em transparent, 22em 88em #3a3a3a, 33em 88em #f5cbb6, 44em 88em #f5cbb6, 55em 88em #fadece, 66em 88em #fadece, 77em 88em #fadece, 88em 88em #fadece, 99em 88em #fadece, 110em 88em #fadece, 121em 88em #fadece, 132em 88em #fadece, 143em 88em #fadece, 154em 88em #fadece, 165em 88em #fadece, 176em 88em #000, 187em 88em transparent, 11em 99em transparent, 22em 99em #3a3a3a, 33em 99em #f5cbb6, 44em 99em #3a3a3a, 55em 99em #000, 66em 99em #000, 77em 99em #000, 88em 99em #fadece, 99em 99em #fadece, 110em 99em #fadece, 121em 99em #3a3a3a, 132em 99em #000, 143em 99em #000, 154em 99em #000, 165em 99em #fadece, 176em 99em #000, 187em 99em transparent, 11em 110em transparent, 22em 110em #3a3a3a, 33em 110em #f5cbb6, 44em 110em #fadece, 55em 110em #fadece, 66em 110em #3a3a3a, 77em 110em #fadece, 88em 110em #fadece, 99em 110em #f5cbb6, 110em 110em #fadece, 121em 110em #fadece, 132em 110em #3a3a3a, 143em 110em #fadece, 154em 110em #fadece, 165em 110em #fadece, 176em 110em #000, 187em 110em transparent, 11em 121em transparent, 22em 121em #fadece, 33em 121em #f5cbb6, 44em 121em #fadece, 55em 121em #fadece, 66em 121em #fadece, 77em 121em #fadece, 88em 121em #fadece, 99em 121em #f5cbb6, 110em 121em #fadece, 121em 121em #fadece, 132em 121em #fadece, 143em 121em #fadece, 154em 121em #fadece, 165em 121em #fadece, 176em 121em #f5cbb6, 187em 121em transparent, 11em 132em transparent, 22em 132em #fadece, 33em 132em #f5cbb6, 44em 132em #fadece, 55em 132em #fadece, 66em 132em #fadece, 77em 132em #fadece, 88em 132em #fadece, 99em 132em #f5cbb6, 110em 132em #fadece, 121em 132em #fadece, 132em 132em #fadece, 143em 132em #fadece, 154em 132em #fadece, 165em 132em #fadece, 176em 132em #f5cbb6, 187em 132em transparent, 11em 143em transparent, 22em 143em #fadece, 33em 143em #f5cbb6, 44em 143em #fadece, 55em 143em #fadece, 66em 143em #fadece, 77em 143em #fadece, 88em 143em #fadece, 99em 143em #f5cbb6, 110em 143em #fadece, 121em 143em #fadece, 132em 143em #fadece, 143em 143em #fadece, 154em 143em #fadece, 165em 143em #fadece, 176em 143em #f5cbb6, 187em 143em transparent, 11em 154em transparent, 22em 154em transparent, 33em 154em #f5cbb6, 44em 154em #fadece, 55em 154em #fadece, 66em 154em #fadece, 77em 154em #fadece, 88em 154em #f5cbb6, 99em 154em #f5cbb6, 110em 154em #f5cbb6, 121em 154em #fadece, 132em 154em #fadece, 143em 154em #fadece, 154em 154em #fadece, 165em 154em #fadece, 176em 154em transparent, 187em 154em transparent, 11em 165em transparent, 22em 165em transparent, 33em 165em #f5cbb6, 44em 165em #fadece, 55em 165em #fadece, 66em 165em #fadece, 77em 165em #3a3a3a, 88em 165em #3a3a3a, 99em 165em #3a3a3a, 110em 165em #3a3a3a, 121em 165em #3a3a3a, 132em 165em #fadece, 143em 165em #fadece, 154em 165em #fadece, 165em 165em #fadece, 176em 165em transparent, 187em 165em transparent, 11em 176em transparent, 22em 176em transparent, 33em 176em #f5cbb6, 44em 176em #fadece, 55em 176em #fadece, 66em 176em #3a3a3a, 77em 176em #3a3a3a, 88em 176em #3a3a3a, 99em 176em #3a3a3a, 110em 176em #3a3a3a, 121em 176em #3a3a3a, 132em 176em #3a3a3a, 143em 176em #fadece, 154em 176em #fadece, 165em 176em #fadece, 176em 176em transparent, 187em 176em transparent, 11em 187em transparent, 22em 187em transparent, 33em 187em #f5cbb6, 44em 187em #fadece, 55em 187em #fadece, 66em 187em #3a3a3a, 77em 187em transparent, 88em 187em transparent, 99em 187em transparent, 110em 187em transparent, 121em 187em transparent, 132em 187em #3a3a3a, 143em 187em #fadece, 154em 187em #fadece, 165em 187em #fadece, 176em 187em transparent, 187em 187em transparent, 11em 198em transparent, 22em 198em transparent, 33em 198em transparent, 44em 198em #e5ddd9, 55em 198em #e5ddd9, 66em 198em #3a3a3a, 77em 198em #e5ddd9, 88em 198em transparent, 99em 198em transparent, 110em 198em transparent, 121em 198em #e5ddd9, 132em 198em #3a3a3a, 143em 198em #e5ddd9, 154em 198em #e5ddd9, 165em 198em transparent, 176em 198em transparent, 187em 198em transparent, 11em 209em transparent, 22em 209em transparent, 33em 209em transparent, 44em 209em transparent, 55em 209em #e5ddd9, 66em 209em #3a3a3a, 77em 209em #e5ddd9, 88em 209em #3a3a3a, 99em 209em #3a3a3a, 110em 209em #3a3a3a, 121em 209em #e5ddd9, 132em 209em #3a3a3a, 143em 209em #e5ddd9, 154em 209em transparent, 165em 209em transparent, 176em 209em transparent, 187em 209em transparent, 11em 220em transparent, 22em 220em transparent, 33em 220em transparent, 44em 220em transparent, 55em 220em transparent, 66em 220em #3a3a3a, 77em 220em #3a3a3a, 88em 220em #3a3a3a, 99em 220em #3a3a3a, 110em 220em #3a3a3a, 121em 220em #3a3a3a, 132em 220em #3a3a3a, 143em 220em transparent, 154em 220em transparent, 165em 220em transparent, 176em 220em transparent, 187em 220em transparent, 11em 231em transparent, 22em 231em transparent, 33em 231em transparent, 44em 231em transparent, 55em 231em transparent, 66em 231em transparent, 77em 231em #f5cbb6, 88em 231em #fadece, 99em 231em #fadece, 110em 231em #fadece, 121em 231em #fadece, 132em 231em transparent, 143em 231em transparent, 154em 231em transparent, 165em 231em transparent, 176em 231em transparent, 187em 231em transparent, 11em 242em transparent, 22em 242em transparent, 33em 242em transparent, 44em 242em transparent, 55em 242em transparent, 66em 242em #19689d, 77em 242em #f5cbb6, 88em 242em #fadece, 99em 242em #fadece, 110em 242em #fadece, 121em 242em #fadece, 132em 242em #0f75bc, 143em 242em transparent, 154em 242em transparent, 165em 242em transparent, 176em 242em transparent, 187em 242em transparent, 11em 253em transparent, 22em 253em transparent, 33em 253em transparent, 44em 253em transparent, 55em 253em transparent, 66em 253em #19689d, 77em 253em #f5cbb6, 88em 253em #fadece, 99em 253em #fadece, 110em 253em #fadece, 121em 253em #fadece, 132em 253em #0f75bc, 143em 253em transparent, 154em 253em transparent, 165em 253em transparent, 176em 253em transparent, 187em 253em transparent, 11em 264em #19689d, 22em 264em #19689d, 33em 264em #19689d, 44em 264em #19689d, 55em 264em #19689d, 66em 264em #19689d, 77em 264em #19689d, 88em 264em #fadece, 99em 264em #fadece, 110em 264em #fadece, 121em 264em #0f75bc, 132em 264em #0f75bc, 143em 264em #0f75bc, 154em 264em #0f75bc, 165em 264em #0f75bc, 176em 264em #0f75bc, 187em 264em #0f75bc, 11em 275em #19689d, 22em 275em #0f75bc, 33em 275em #0f75bc, 44em 275em #0f75bc, 55em 275em #0f75bc, 66em 275em #0f75bc, 77em 275em #0f75bc, 88em 275em #0f75bc, 99em 275em #19689d, 110em 275em #0f75bc, 121em 275em #0f75bc, 132em 275em #0f75bc, 143em 275em #0f75bc, 154em 275em #0f75bc, 165em 275em #0f75bc, 176em 275em #0f75bc, 187em 275em #0f75bc, 11em 286em #19689d, 22em 286em #0f75bc, 33em 286em #0f75bc, 44em 286em #0f75bc, 55em 286em #0f75bc, 66em 286em #0f75bc, 77em 286em #0f75bc, 88em 286em #0f75bc, 99em 286em #0f75bc, 110em 286em #0f75bc, 121em 286em #0f75bc, 132em 286em #0f75bc, 143em 286em #0f75bc, 154em 286em #0f75bc, 165em 286em #0f75bc, 176em 286em #0f75bc, 187em 286em #0f75bc, 11em 297em #19689d, 22em 297em #0f75bc, 33em 297em #0f75bc, 44em 297em #0f75bc, 55em 297em #0f75bc, 66em 297em #0f75bc, 77em 297em #0f75bc, 88em 297em #0f75bc, 99em 297em #19689d, 110em 297em #0f75bc, 121em 297em #0f75bc, 132em 297em #0f75bc, 143em 297em #0f75bc, 154em 297em #0f75bc, 165em 297em #0f75bc, 176em 297em #0f75bc, 187em 297em #0f75bc;
}
因为您的图片是由 box-shadow
制作的,我发现这是最好的解决方案。您需要将 DIV 元素与 class b 包裹在另一个 DIV 中,然后简单地应用您需要的定位。如果有更有效的方法,我们深表歉意。这允许您将所有内容保存在 CSS.
.container{
position:relative;
width:212px;
height:308px;
}
.container:hover:before {
position:relative;
z-index:2;
content:"";
top:0;
bottom:0;
left:0;
right:0;
background:url('http://masterherald.com/wp-content/uploads/2014/11/Bitcoin-Prices.png');
background-size:212px 308px;
display:block;
width:212px;
height:308px;
}
.b {
content:'';
position: absolute;
top: 0%;
left: 0%;
display:block;
width: 11px;
height: 11px;
box-shadow: 0em 0em transparent, 0em 0em transparent, 11em 0em transparent, 22em 0em transparent, 33em 0em transparent, 44em 0em transparent, 55em 0em transparent, 66em 0em #3a3a3a, 77em 0em #000, 88em 0em #3a3a3a, 99em 0em #000, 110em 0em #000, 121em 0em #000, 132em 0em #000, 143em 0em transparent, 154em 0em transparent, 165em 0em transparent, 176em 0em transparent, 11em 11em transparent, 22em 11em transparent, 33em 11em transparent, 44em 11em transparent, 55em 11em #3a3a3a, 66em 11em #000, 77em 11em #3a3a3a, 88em 11em #000, 99em 11em #000, 110em 11em #000, 121em 11em #000, 132em 11em #000, 143em 11em #000, 154em 11em transparent, 165em 11em transparent, 176em 11em transparent, 187em 11em transparent, 11em 22em transparent, 22em 22em transparent, 33em 22em transparent, 44em 22em #3a3a3a, 55em 22em #000, 66em 22em #3a3a3a, 77em 22em #000, 88em 22em #000, 99em 22em #000, 110em 22em #000, 121em 22em #000, 132em 22em #000, 143em 22em #000, 154em 22em #000, 165em 22em transparent, 176em 22em transparent, 187em 22em transparent, 11em 33em transparent, 22em 33em transparent, 33em 33em #3a3a3a, 44em 33em #000, 55em 33em #3a3a3a, 66em 33em #000, 77em 33em #000, 88em 33em #000, 99em 33em #000, 110em 33em #000, 121em 33em #000, 132em 33em #000, 143em 33em #000, 154em 33em #000, 165em 33em #000, 176em 33em transparent, 187em 33em transparent, 11em 44em transparent, 22em 44em #3a3a3a, 33em 44em #000, 44em 44em #3a3a3a, 55em 44em #000, 66em 44em #000, 77em 44em #000, 88em 44em #000, 99em 44em #000, 110em 44em #000, 121em 44em #000, 132em 44em #000, 143em 44em #000, 154em 44em #000, 165em 44em #000, 176em 44em #000, 187em 44em transparent, 11em 55em transparent, 22em 55em #3a3a3a, 33em 55em #f5cbb6, 44em 55em #f5cbb6, 55em 55em #fadece, 66em 55em #fadece, 77em 55em #fadece, 88em 55em #fadece, 99em 55em #fadece, 110em 55em #fadece, 121em 55em #fadece, 132em 55em #fadece, 143em 55em #fadece, 154em 55em #fadece, 165em 55em #fadece, 176em 55em #000, 187em 55em transparent, 11em 66em transparent, 22em 66em #3a3a3a, 33em 66em #f5cbb6, 44em 66em #f5cbb6, 55em 66em #fadece, 66em 66em #fadece, 77em 66em #fadece, 88em 66em #fadece, 99em 66em #fadece, 110em 66em #fadece, 121em 66em #fadece, 132em 66em #fadece, 143em 66em #fadece, 154em 66em #fadece, 165em 66em #fadece, 176em 66em #000, 187em 66em transparent, 11em 77em transparent, 22em 77em #3a3a3a, 33em 77em #f5cbb6, 44em 77em #f5cbb6, 55em 77em #fadece, 66em 77em #fadece, 77em 77em #fadece, 88em 77em #fadece, 99em 77em #fadece, 110em 77em #fadece, 121em 77em #fadece, 132em 77em #fadece, 143em 77em #fadece, 154em 77em #fadece, 165em 77em #fadece, 176em 77em #000, 187em 77em transparent, 11em 88em transparent, 22em 88em #3a3a3a, 33em 88em #f5cbb6, 44em 88em #f5cbb6, 55em 88em #fadece, 66em 88em #fadece, 77em 88em #fadece, 88em 88em #fadece, 99em 88em #fadece, 110em 88em #fadece, 121em 88em #fadece, 132em 88em #fadece, 143em 88em #fadece, 154em 88em #fadece, 165em 88em #fadece, 176em 88em #000, 187em 88em transparent, 11em 99em transparent, 22em 99em #3a3a3a, 33em 99em #f5cbb6, 44em 99em #3a3a3a, 55em 99em #000, 66em 99em #000, 77em 99em #000, 88em 99em #fadece, 99em 99em #fadece, 110em 99em #fadece, 121em 99em #3a3a3a, 132em 99em #000, 143em 99em #000, 154em 99em #000, 165em 99em #fadece, 176em 99em #000, 187em 99em transparent, 11em 110em transparent, 22em 110em #3a3a3a, 33em 110em #f5cbb6, 44em 110em #fadece, 55em 110em #fadece, 66em 110em #3a3a3a, 77em 110em #fadece, 88em 110em #fadece, 99em 110em #f5cbb6, 110em 110em #fadece, 121em 110em #fadece, 132em 110em #3a3a3a, 143em 110em #fadece, 154em 110em #fadece, 165em 110em #fadece, 176em 110em #000, 187em 110em transparent, 11em 121em transparent, 22em 121em #fadece, 33em 121em #f5cbb6, 44em 121em #fadece, 55em 121em #fadece, 66em 121em #fadece, 77em 121em #fadece, 88em 121em #fadece, 99em 121em #f5cbb6, 110em 121em #fadece, 121em 121em #fadece, 132em 121em #fadece, 143em 121em #fadece, 154em 121em #fadece, 165em 121em #fadece, 176em 121em #f5cbb6, 187em 121em transparent, 11em 132em transparent, 22em 132em #fadece, 33em 132em #f5cbb6, 44em 132em #fadece, 55em 132em #fadece, 66em 132em #fadece, 77em 132em #fadece, 88em 132em #fadece, 99em 132em #f5cbb6, 110em 132em #fadece, 121em 132em #fadece, 132em 132em #fadece, 143em 132em #fadece, 154em 132em #fadece, 165em 132em #fadece, 176em 132em #f5cbb6, 187em 132em transparent, 11em 143em transparent, 22em 143em #fadece, 33em 143em #f5cbb6, 44em 143em #fadece, 55em 143em #fadece, 66em 143em #fadece, 77em 143em #fadece, 88em 143em #fadece, 99em 143em #f5cbb6, 110em 143em #fadece, 121em 143em #fadece, 132em 143em #fadece, 143em 143em #fadece, 154em 143em #fadece, 165em 143em #fadece, 176em 143em #f5cbb6, 187em 143em transparent, 11em 154em transparent, 22em 154em transparent, 33em 154em #f5cbb6, 44em 154em #fadece, 55em 154em #fadece, 66em 154em #fadece, 77em 154em #fadece, 88em 154em #f5cbb6, 99em 154em #f5cbb6, 110em 154em #f5cbb6, 121em 154em #fadece, 132em 154em #fadece, 143em 154em #fadece, 154em 154em #fadece, 165em 154em #fadece, 176em 154em transparent, 187em 154em transparent, 11em 165em transparent, 22em 165em transparent, 33em 165em #f5cbb6, 44em 165em #fadece, 55em 165em #fadece, 66em 165em #fadece, 77em 165em #3a3a3a, 88em 165em #3a3a3a, 99em 165em #3a3a3a, 110em 165em #3a3a3a, 121em 165em #3a3a3a, 132em 165em #fadece, 143em 165em #fadece, 154em 165em #fadece, 165em 165em #fadece, 176em 165em transparent, 187em 165em transparent, 11em 176em transparent, 22em 176em transparent, 33em 176em #f5cbb6, 44em 176em #fadece, 55em 176em #fadece, 66em 176em #3a3a3a, 77em 176em #3a3a3a, 88em 176em #3a3a3a, 99em 176em #3a3a3a, 110em 176em #3a3a3a, 121em 176em #3a3a3a, 132em 176em #3a3a3a, 143em 176em #fadece, 154em 176em #fadece, 165em 176em #fadece, 176em 176em transparent, 187em 176em transparent, 11em 187em transparent, 22em 187em transparent, 33em 187em #f5cbb6, 44em 187em #fadece, 55em 187em #fadece, 66em 187em #3a3a3a, 77em 187em transparent, 88em 187em transparent, 99em 187em transparent, 110em 187em transparent, 121em 187em transparent, 132em 187em #3a3a3a, 143em 187em #fadece, 154em 187em #fadece, 165em 187em #fadece, 176em 187em transparent, 187em 187em transparent, 11em 198em transparent, 22em 198em transparent, 33em 198em transparent, 44em 198em #e5ddd9, 55em 198em #e5ddd9, 66em 198em #3a3a3a, 77em 198em #e5ddd9, 88em 198em transparent, 99em 198em transparent, 110em 198em transparent, 121em 198em #e5ddd9, 132em 198em #3a3a3a, 143em 198em #e5ddd9, 154em 198em #e5ddd9, 165em 198em transparent, 176em 198em transparent, 187em 198em transparent, 11em 209em transparent, 22em 209em transparent, 33em 209em transparent, 44em 209em transparent, 55em 209em #e5ddd9, 66em 209em #3a3a3a, 77em 209em #e5ddd9, 88em 209em #3a3a3a, 99em 209em #3a3a3a, 110em 209em #3a3a3a, 121em 209em #e5ddd9, 132em 209em #3a3a3a, 143em 209em #e5ddd9, 154em 209em transparent, 165em 209em transparent, 176em 209em transparent, 187em 209em transparent, 11em 220em transparent, 22em 220em transparent, 33em 220em transparent, 44em 220em transparent, 55em 220em transparent, 66em 220em #3a3a3a, 77em 220em #3a3a3a, 88em 220em #3a3a3a, 99em 220em #3a3a3a, 110em 220em #3a3a3a, 121em 220em #3a3a3a, 132em 220em #3a3a3a, 143em 220em transparent, 154em 220em transparent, 165em 220em transparent, 176em 220em transparent, 187em 220em transparent, 11em 231em transparent, 22em 231em transparent, 33em 231em transparent, 44em 231em transparent, 55em 231em transparent, 66em 231em transparent, 77em 231em #f5cbb6, 88em 231em #fadece, 99em 231em #fadece, 110em 231em #fadece, 121em 231em #fadece, 132em 231em transparent, 143em 231em transparent, 154em 231em transparent, 165em 231em transparent, 176em 231em transparent, 187em 231em transparent, 11em 242em transparent, 22em 242em transparent, 33em 242em transparent, 44em 242em transparent, 55em 242em transparent, 66em 242em #19689d, 77em 242em #f5cbb6, 88em 242em #fadece, 99em 242em #fadece, 110em 242em #fadece, 121em 242em #fadece, 132em 242em #0f75bc, 143em 242em transparent, 154em 242em transparent, 165em 242em transparent, 176em 242em transparent, 187em 242em transparent, 11em 253em transparent, 22em 253em transparent, 33em 253em transparent, 44em 253em transparent, 55em 253em transparent, 66em 253em #19689d, 77em 253em #f5cbb6, 88em 253em #fadece, 99em 253em #fadece, 110em 253em #fadece, 121em 253em #fadece, 132em 253em #0f75bc, 143em 253em transparent, 154em 253em transparent, 165em 253em transparent, 176em 253em transparent, 187em 253em transparent, 11em 264em #19689d, 22em 264em #19689d, 33em 264em #19689d, 44em 264em #19689d, 55em 264em #19689d, 66em 264em #19689d, 77em 264em #19689d, 88em 264em #fadece, 99em 264em #fadece, 110em 264em #fadece, 121em 264em #0f75bc, 132em 264em #0f75bc, 143em 264em #0f75bc, 154em 264em #0f75bc, 165em 264em #0f75bc, 176em 264em #0f75bc, 187em 264em #0f75bc, 11em 275em #19689d, 22em 275em #0f75bc, 33em 275em #0f75bc, 44em 275em #0f75bc, 55em 275em #0f75bc, 66em 275em #0f75bc, 77em 275em #0f75bc, 88em 275em #0f75bc, 99em 275em #19689d, 110em 275em #0f75bc, 121em 275em #0f75bc, 132em 275em #0f75bc, 143em 275em #0f75bc, 154em 275em #0f75bc, 165em 275em #0f75bc, 176em 275em #0f75bc, 187em 275em #0f75bc, 11em 286em #19689d, 22em 286em #0f75bc, 33em 286em #0f75bc, 44em 286em #0f75bc, 55em 286em #0f75bc, 66em 286em #0f75bc, 77em 286em #0f75bc, 88em 286em #0f75bc, 99em 286em #0f75bc, 110em 286em #0f75bc, 121em 286em #0f75bc, 132em 286em #0f75bc, 143em 286em #0f75bc, 154em 286em #0f75bc, 165em 286em #0f75bc, 176em 286em #0f75bc, 187em 286em #0f75bc, 11em 297em #19689d, 22em 297em #0f75bc, 33em 297em #0f75bc, 44em 297em #0f75bc, 55em 297em #0f75bc, 66em 297em #0f75bc, 77em 297em #0f75bc, 88em 297em #0f75bc, 99em 297em #19689d, 110em 297em #0f75bc, 121em 297em #0f75bc, 132em 297em #0f75bc, 143em 297em #0f75bc, 154em 297em #0f75bc, 165em 297em #0f75bc, 176em 297em #0f75bc, 187em 297em #0f75bc;
}
如果你使用 font-size 来调整 .b
的大小,那么 #infoi
也一样
http://codepen.io/anon/pen/OPdjzX
.container {
position: relative;
display: block;
width: 300px;
height: 500px;
}
.b {
position: absolute;
top: 0;
left: 0;
}
#infoi b {
font-size:25em;
}
#infoi {
position: absolute;
left: 25em;
top: 45em;
height:182.5em;
width:160em;
}
#infoi img {
height:100%;
width:100%;
}
.container #infoi {
opacity: 0;
transition: opacity 0.5s;
}
.container:hover #infoi {
opacity: 1;
}
/* Smartphones ----------- */
@media (min-width : 320px) and (max-width : 480px) {
.b, #infoi {
font-size: 0.5px;
}
}
/* iPads ----------- */
@media (min-width : 480px) and (max-width : 1024px) {
.b, #infoi {
font-size: 0.7px;
}
}
/* Desktops and laptops ----------- */
@media (min-width : 1024px) {
.b, #infoi {
font-size: 1px;
}
}
/* Large screens ----------- */
@media (min-width : 1824px) {
.b, #infoi {
font-size: 1.5px;
}
}
.b {
content:'';
position: absolute;
display: block;
box-sizing: border-box;
width: 11px;
height: 11px;
box-shadow: 0em 0em transparent, 0em 0em transparent, 11em 0em transparent, 22em 0em transparent, 33em 0em transparent, 44em 0em transparent, 55em 0em transparent, 66em 0em #3a3a3a, 77em 0em #000, 88em 0em #3a3a3a, 99em 0em #000, 110em 0em #000, 121em 0em #000, 132em 0em #000, 143em 0em transparent, 154em 0em transparent, 165em 0em transparent, 176em 0em transparent, 11em 11em transparent, 22em 11em transparent, 33em 11em transparent, 44em 11em transparent, 55em 11em #3a3a3a, 66em 11em #000, 77em 11em #3a3a3a, 88em 11em #000, 99em 11em #000, 110em 11em #000, 121em 11em #000, 132em 11em #000, 143em 11em #000, 154em 11em transparent, 165em 11em transparent, 176em 11em transparent, 187em 11em transparent, 11em 22em transparent, 22em 22em transparent, 33em 22em transparent, 44em 22em #3a3a3a, 55em 22em #000, 66em 22em #3a3a3a, 77em 22em #000, 88em 22em #000, 99em 22em #000, 110em 22em #000, 121em 22em #000, 132em 22em #000, 143em 22em #000, 154em 22em #000, 165em 22em transparent, 176em 22em transparent, 187em 22em transparent, 11em 33em transparent, 22em 33em transparent, 33em 33em #3a3a3a, 44em 33em #000, 55em 33em #3a3a3a, 66em 33em #000, 77em 33em #000, 88em 33em #000, 99em 33em #000, 110em 33em #000, 121em 33em #000, 132em 33em #000, 143em 33em #000, 154em 33em #000, 165em 33em #000, 176em 33em transparent, 187em 33em transparent, 11em 44em transparent, 22em 44em #3a3a3a, 33em 44em #000, 44em 44em #3a3a3a, 55em 44em #000, 66em 44em #000, 77em 44em #000, 88em 44em #000, 99em 44em #000, 110em 44em #000, 121em 44em #000, 132em 44em #000, 143em 44em #000, 154em 44em #000, 165em 44em #000, 176em 44em #000, 187em 44em transparent, 11em 55em transparent, 22em 55em #3a3a3a, 33em 55em #f5cbb6, 44em 55em #f5cbb6, 55em 55em #fadece, 66em 55em #fadece, 77em 55em #fadece, 88em 55em #fadece, 99em 55em #fadece, 110em 55em #fadece, 121em 55em #fadece, 132em 55em #fadece, 143em 55em #fadece, 154em 55em #fadece, 165em 55em #fadece, 176em 55em #000, 187em 55em transparent, 11em 66em transparent, 22em 66em #3a3a3a, 33em 66em #f5cbb6, 44em 66em #f5cbb6, 55em 66em #fadece, 66em 66em #fadece, 77em 66em #fadece, 88em 66em #fadece, 99em 66em #fadece, 110em 66em #fadece, 121em 66em #fadece, 132em 66em #fadece, 143em 66em #fadece, 154em 66em #fadece, 165em 66em #fadece, 176em 66em #000, 187em 66em transparent, 11em 77em transparent, 22em 77em #3a3a3a, 33em 77em #f5cbb6, 44em 77em #f5cbb6, 55em 77em #fadece, 66em 77em #fadece, 77em 77em #fadece, 88em 77em #fadece, 99em 77em #fadece, 110em 77em #fadece, 121em 77em #fadece, 132em 77em #fadece, 143em 77em #fadece, 154em 77em #fadece, 165em 77em #fadece, 176em 77em #000, 187em 77em transparent, 11em 88em transparent, 22em 88em #3a3a3a, 33em 88em #f5cbb6, 44em 88em #f5cbb6, 55em 88em #fadece, 66em 88em #fadece, 77em 88em #fadece, 88em 88em #fadece, 99em 88em #fadece, 110em 88em #fadece, 121em 88em #fadece, 132em 88em #fadece, 143em 88em #fadece, 154em 88em #fadece, 165em 88em #fadece, 176em 88em #000, 187em 88em transparent, 11em 99em transparent, 22em 99em #3a3a3a, 33em 99em #f5cbb6, 44em 99em #3a3a3a, 55em 99em #000, 66em 99em #000, 77em 99em #000, 88em 99em #fadece, 99em 99em #fadece, 110em 99em #fadece, 121em 99em #3a3a3a, 132em 99em #000, 143em 99em #000, 154em 99em #000, 165em 99em #fadece, 176em 99em #000, 187em 99em transparent, 11em 110em transparent, 22em 110em #3a3a3a, 33em 110em #f5cbb6, 44em 110em #fadece, 55em 110em #fadece, 66em 110em #3a3a3a, 77em 110em #fadece, 88em 110em #fadece, 99em 110em #f5cbb6, 110em 110em #fadece, 121em 110em #fadece, 132em 110em #3a3a3a, 143em 110em #fadece, 154em 110em #fadece, 165em 110em #fadece, 176em 110em #000, 187em 110em transparent, 11em 121em transparent, 22em 121em #fadece, 33em 121em #f5cbb6, 44em 121em #fadece, 55em 121em #fadece, 66em 121em #fadece, 77em 121em #fadece, 88em 121em #fadece, 99em 121em #f5cbb6, 110em 121em #fadece, 121em 121em #fadece, 132em 121em #fadece, 143em 121em #fadece, 154em 121em #fadece, 165em 121em #fadece, 176em 121em #f5cbb6, 187em 121em transparent, 11em 132em transparent, 22em 132em #fadece, 33em 132em #f5cbb6, 44em 132em #fadece, 55em 132em #fadece, 66em 132em #fadece, 77em 132em #fadece, 88em 132em #fadece, 99em 132em #f5cbb6, 110em 132em #fadece, 121em 132em #fadece, 132em 132em #fadece, 143em 132em #fadece, 154em 132em #fadece, 165em 132em #fadece, 176em 132em #f5cbb6, 187em 132em transparent, 11em 143em transparent, 22em 143em #fadece, 33em 143em #f5cbb6, 44em 143em #fadece, 55em 143em #fadece, 66em 143em #fadece, 77em 143em #fadece, 88em 143em #fadece, 99em 143em #f5cbb6, 110em 143em #fadece, 121em 143em #fadece, 132em 143em #fadece, 143em 143em #fadece, 154em 143em #fadece, 165em 143em #fadece, 176em 143em #f5cbb6, 187em 143em transparent, 11em 154em transparent, 22em 154em transparent, 33em 154em #f5cbb6, 44em 154em #fadece, 55em 154em #fadece, 66em 154em #fadece, 77em 154em #fadece, 88em 154em #f5cbb6, 99em 154em #f5cbb6, 110em 154em #f5cbb6, 121em 154em #fadece, 132em 154em #fadece, 143em 154em #fadece, 154em 154em #fadece, 165em 154em #fadece, 176em 154em transparent, 187em 154em transparent, 11em 165em transparent, 22em 165em transparent, 33em 165em #f5cbb6, 44em 165em #fadece, 55em 165em #fadece, 66em 165em #fadece, 77em 165em #3a3a3a, 88em 165em #3a3a3a, 99em 165em #3a3a3a, 110em 165em #3a3a3a, 121em 165em #3a3a3a, 132em 165em #fadece, 143em 165em #fadece, 154em 165em #fadece, 165em 165em #fadece, 176em 165em transparent, 187em 165em transparent, 11em 176em transparent, 22em 176em transparent, 33em 176em #f5cbb6, 44em 176em #fadece, 55em 176em #fadece, 66em 176em #3a3a3a, 77em 176em #3a3a3a, 88em 176em #3a3a3a, 99em 176em #3a3a3a, 110em 176em #3a3a3a, 121em 176em #3a3a3a, 132em 176em #3a3a3a, 143em 176em #fadece, 154em 176em #fadece, 165em 176em #fadece, 176em 176em transparent, 187em 176em transparent, 11em 187em transparent, 22em 187em transparent, 33em 187em #f5cbb6, 44em 187em #fadece, 55em 187em #fadece, 66em 187em #3a3a3a, 77em 187em transparent, 88em 187em transparent, 99em 187em transparent, 110em 187em transparent, 121em 187em transparent, 132em 187em #3a3a3a, 143em 187em #fadece, 154em 187em #fadece, 165em 187em #fadece, 176em 187em transparent, 187em 187em transparent, 11em 198em transparent, 22em 198em transparent, 33em 198em transparent, 44em 198em #e5ddd9, 55em 198em #e5ddd9, 66em 198em #3a3a3a, 77em 198em #e5ddd9, 88em 198em transparent, 99em 198em transparent, 110em 198em transparent, 121em 198em #e5ddd9, 132em 198em #3a3a3a, 143em 198em #e5ddd9, 154em 198em #e5ddd9, 165em 198em transparent, 176em 198em transparent, 187em 198em transparent, 11em 209em transparent, 22em 209em transparent, 33em 209em transparent, 44em 209em transparent, 55em 209em #e5ddd9, 66em 209em #3a3a3a, 77em 209em #e5ddd9, 88em 209em #3a3a3a, 99em 209em #3a3a3a, 110em 209em #3a3a3a, 121em 209em #e5ddd9, 132em 209em #3a3a3a, 143em 209em #e5ddd9, 154em 209em transparent, 165em 209em transparent, 176em 209em transparent, 187em 209em transparent, 11em 220em transparent, 22em 220em transparent, 33em 220em transparent, 44em 220em transparent, 55em 220em transparent, 66em 220em #3a3a3a, 77em 220em #3a3a3a, 88em 220em #3a3a3a, 99em 220em #3a3a3a, 110em 220em #3a3a3a, 121em 220em #3a3a3a, 132em 220em #3a3a3a, 143em 220em transparent, 154em 220em transparent, 165em 220em transparent, 176em 220em transparent, 187em 220em transparent, 11em 231em transparent, 22em 231em transparent, 33em 231em transparent, 44em 231em transparent, 55em 231em transparent, 66em 231em transparent, 77em 231em #f5cbb6, 88em 231em #fadece, 99em 231em #fadece, 110em 231em #fadece, 121em 231em #fadece, 132em 231em transparent, 143em 231em transparent, 154em 231em transparent, 165em 231em transparent, 176em 231em transparent, 187em 231em transparent, 11em 242em transparent, 22em 242em transparent, 33em 242em transparent, 44em 242em transparent, 55em 242em transparent, 66em 242em #19689d, 77em 242em #f5cbb6, 88em 242em #fadece, 99em 242em #fadece, 110em 242em #fadece, 121em 242em #fadece, 132em 242em #0f75bc, 143em 242em transparent, 154em 242em transparent, 165em 242em transparent, 176em 242em transparent, 187em 242em transparent, 11em 253em transparent, 22em 253em transparent, 33em 253em transparent, 44em 253em transparent, 55em 253em transparent, 66em 253em #19689d, 77em 253em #f5cbb6, 88em 253em #fadece, 99em 253em #fadece, 110em 253em #fadece, 121em 253em #fadece, 132em 253em #0f75bc, 143em 253em transparent, 154em 253em transparent, 165em 253em transparent, 176em 253em transparent, 187em 253em transparent, 11em 264em #19689d, 22em 264em #19689d, 33em 264em #19689d, 44em 264em #19689d, 55em 264em #19689d, 66em 264em #19689d, 77em 264em #19689d, 88em 264em #fadece, 99em 264em #fadece, 110em 264em #fadece, 121em 264em #0f75bc, 132em 264em #0f75bc, 143em 264em #0f75bc, 154em 264em #0f75bc, 165em 264em #0f75bc, 176em 264em #0f75bc, 187em 264em #0f75bc, 11em 275em #19689d, 22em 275em #0f75bc, 33em 275em #0f75bc, 44em 275em #0f75bc, 55em 275em #0f75bc, 66em 275em #0f75bc, 77em 275em #0f75bc, 88em 275em #0f75bc, 99em 275em #19689d, 110em 275em #0f75bc, 121em 275em #0f75bc, 132em 275em #0f75bc, 143em 275em #0f75bc, 154em 275em #0f75bc, 165em 275em #0f75bc, 176em 275em #0f75bc, 187em 275em #0f75bc, 11em 286em #19689d, 22em 286em #0f75bc, 33em 286em #0f75bc, 44em 286em #0f75bc, 55em 286em #0f75bc, 66em 286em #0f75bc, 77em 286em #0f75bc, 88em 286em #0f75bc, 99em 286em #0f75bc, 110em 286em #0f75bc, 121em 286em #0f75bc, 132em 286em #0f75bc, 143em 286em #0f75bc, 154em 286em #0f75bc, 165em 286em #0f75bc, 176em 286em #0f75bc, 187em 286em #0f75bc, 11em 297em #19689d, 22em 297em #0f75bc, 33em 297em #0f75bc, 44em 297em #0f75bc, 55em 297em #0f75bc, 66em 297em #0f75bc, 77em 297em #0f75bc, 88em 297em #0f75bc, 99em 297em #19689d, 110em 297em #0f75bc, 121em 297em #0f75bc, 132em 297em #0f75bc, 143em 297em #0f75bc, 154em 297em #0f75bc, 165em 297em #0f75bc, 176em 297em #0f75bc, 187em 297em #0f75bc;
}
<header>
<div class="container clearfix">
<!--Pixel Me Dude -->
<div class="b"></div>
<div id="infoi"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/2000px-Smiley.svg.png" /><b>blop bla bla</b></div>
</div>
</header>
您需要调整左侧、顶部的高度和宽度以完全覆盖您想要的区域:)