I have the following divs
<div id="outer"><img src="myimgpath"><div id="name">Username</div></div>
How do I fix the inner div to the oute开发者_如何转开发r div's top right corner?
Try something like this:
#outer {
position: relative;
overflow: hidden;
height: 100px;
}
#name {
position: absolute;
right: 0;
}
<div id="outer" style="position:relative">
<img src="myimgpath">
<div id="name" style="position:absolute; top:0px; right:0px;">Username</div>
</div>
add float:right;
to the inner div
精彩评论