开发者

How do I attach a sticky element exactly to the side of my main wrapper

I want to attach a sticky element(containing social media icons) to the right of my main wrap开发者_StackOverflow中文版per which has a width of 960px and not stuck to the right side of the screen.

Any simple CSS ways of doing this?

Thanks


div#wrapper {
    position: relative;
}
div#socialmediaicons {
    position: absolute;
    top: 0;
    right: 0;
}

<div id="wrapper">
    <div id="socialmediaicons"> ... </div>
</div>

"Absolutely" positioned elements will be positioned with respect to the closest parent element that is itself positioned.


There is a good jQuery plugin for this very need:

http://plugins.jquery.com/project/stickyfloat

Tt gives you powers beyond mere CSS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜