html - (mobile web development) how to make a circle with "border-radius:50%" when its width is percent 80% -


i used make circle "width:100px;height:100px;border-radius:50%" in pc; there wrong when same thing in mobile, because width in pc "px", width in mobile "percent", can't ensure width , mobile in mobile same;

div{border:1px solid #ddd;border-radius:50%;width:80%;height:???}
<div></div>

just add padding-top same value width.

div {   border:1px solid #ddd;   border-radius:50%;   width:80%;   height:auto;   padding-top: 80%; /* value same width */ } 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -