염딩코

[CSS] display: flex와 float: right가 함께 적용되지 않을 때 본문

Front-End/CSS

[CSS] display: flex와 float: right가 함께 적용되지 않을 때

johnyeom 2023. 6. 20. 15:43

 

 

 

 

https://stackoverflow.com/questions/36182635/making-a-flex-item-float-right" target="_blank" rel="noopener" data-mce-href="http:// https://stackoverflow.com/questions/36182635/making-a-flex-item-float-right">http:// https://stackoverflow.com/questions/36182635/making-a-flex-item-float-right 

 

Making a flex item float right

I have a <div class="parent"> <div class="child" style="float:right"> Ignore parent? </div> <div> another child </div> </div> The parent has .parent {...

stackoverflow.com

스택오버플로우를 읽어보시면 알 수 있습니다.

 

결론: float: right 대신 margin-left: auto를 사용하면 해결할 수 있다.

'Front-End > CSS' 카테고리의 다른 글

[CSS] div내 요소 중 float:right 이탈 문제 해결  (0) 2023.06.18
[CSS] vw, vh란?  (0) 2023.04.10
Flexbox의 모든 것 (display: flex)  (0) 2023.02.15
Layout: display와 position  (0) 2023.02.13
Selector란? (feat. margin, padding)  (1) 2023.02.12