2021年1月4日星期一

How do you make the inner div float right?

I would like to get the inner div with an id of a to align with the right border of the parent div. How can this be achieved?

It seems like the way I have sized things prevents me from doing this.

Can copy and paste this code into about:blank to see the results.

<body>    <div style="position: absolute; width: fit-content;">    <div style="display: flex; width:100%; height:30px; background:red;">        <div>hello world</div>        <div id="a" style="float: right;">hello world</div>    </div>    <div style="display: flex; width:fit-content; height:30px; background:red;">      <div>hello world</div>      <div>hello asdfasdf world</div>    </div>  </div>    </body>  
https://stackoverflow.com/questions/65571895/how-do-you-make-the-inner-div-float-right January 05, 2021 at 09:05AM

没有评论:

发表评论