Hi i am planning to make a div to place at the top right corner of another div
.another
{
position:fixed;
padding:09px;
margin:auto;
left:25%;
width:auto;
height:auto;
background:#ffffff;
z-index:999999;
}
.topcorner
{
float:right;
position:fixed;
left:25%;
z-index:99999999;
}
this is my html
<div class="another">
<div class="topcorner">
i am at top right corner
</div>
here is some other content
</div>
How to make topcorner div to place it in top right corner
Use position:relative to parent div and absolute to child div
.another{
position:relative;
border:blue solid 1px;
height:200px;
background:#ffffff;
}
.topcorner{
background:red;
width:30px;
height:30px;
position:absolute;
top:0;
right:0;;
}
DEMO
try this,
.another
{
position:relative;
padding:09px;
margin:auto;
width:auto;
height:200px;
background:#eee;
z-index:999999;
}
.topcorner
{
position:absolute;
top:0;
right:0;
z-index:99999999;
width:100px;
height:auto;
background:yellow;
}
jsFiddle File
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With