I want to use span inside div
div is used to put a red horizontal line
<div style="background-color:red;">
</div>
span is used inside div to put elements to right
<div style="background-color:red;">
<span style="float:right;">
ABC
</span>
</div>
But the horizontal line do not get red color, only ABC is shown in right, infact there is no effect of div style like width:900px..….why?
I’d suggest:
Otherwise, you need to add
overflow:autoto your div’s style definition if you do want to leverage the<span>as in your original example.Cheers