我正在为网站做 cookie bar
<div id="cookie" class="md_blkn">
<div id="cookie-content">
<h3 class="pts">WE USE COOKIES</h3>
<p>We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we will assume that you are happy to receive all cookies from this website. We use cookies to ensure that we give you the best experience on our website.</p> <a class="btn-gray-light-solid-s mbs" href="#">OKAY GOT IT</a>
</div>
</div>
我已经设法通过 CSS lef 将图标添加到段落中,但是我不能将它保留到 cookie-content 元素中。有人可以给我提示我做错了什么吗?我相信这对于熟练的 CSS 人员来说很容易:)
这是一个活生生的例子((I)圆圈必须靠近内容): http://jsfiddle.net/dpastov/kU9F6/
最佳答案
设置顶部位置时使用百分比,以便它可以缩放到内容高度。
#cookie-content
{
position: relative;
}
#cookie-content:before
{
top: 40%;
left: -75px;
}
关于javascript - 伪元素离我的 DIV 很远,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24974335/