Home Position fixed div with relative to the the parent container
Reply: 0

Position fixed div with relative to the the parent container

user784
1#
user784 Published in June 19, 2018, 7:53 pm

I want to add a div in right sidebar which is fixed and relative to the parent container just like this in this website see the right sidebar this is exactly what I want for my website

I tried many things but not got any result here is my code

<div id="parent_div">
 <div id="fixed_div">
  Some Content here.....
 </div>
</div>


parent_div
{
 float:right;
 width:300px;
 margin-top:50px;
 margin-right:5px;
 position:relative;
 border:1px solid red;
}

fixed_div
{
 position:fixed;
 width:300px;
 background-color:#084B8A;
 padding:10px;
 box-sizing:border-box;
}

How can I do this in css which is cross browser and if it is not possible in css how can I do this in jquery or javascript

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.334016 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO