Reputation: 3730
I want an element in HTML to be positioned relative to it's parent, similar to this question, but using inline.
I have a fiddle to demonstrate. For this example, I would like the textbox to cover the text (using margin:0;
, not a negative value.
Can it be done?
Upvotes: 2
Views: 7646
Reputation: 157294
Try using position:relative;
and position: absolute;
like this :
Or just use left: 0px;
instead of margin
but make sure that the parent div
to be positioned
relative
Upvotes: 3
Reputation: 5408
<div>
<input value="Text" />
</div>
Or are you using this for something other than inputs?
Since you're already using absolute positioning, you could just do left: 0
.
Upvotes: 0