make circle image acording to screen size with css

拈花ヽ惹草 提交于 2019-12-05 22:48:29

use vw units. They are dependent on viewport-width. so, it can be like width: 2vw;height:2vw; Circle width will depend upon the device width.

.image {
     height: 5vw; 
     width: 5vw; 
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px gray;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
} 
<div class="image"></div>

For >ionic2

<ion-card text-center class="hide-card">
    <img src="http://placehold.it/300x200" class="custom-avatar"/>
    <h2>Victorcodex</h2>
    <p>Have some p tag here</p>
    <p>I am the third guy inline here</p>
    <hr>
</ion-card>

.hide-card {
  -webkit-box-shadow: none!important;
}

.custom-avatar {
  height: 30vw;
  width: 30vw;
  border: 1px solid #fff;
  border-radius: 50%;
  display: inline-block;
  margin-left: auto;
  margin-right: auto;
}

Kindly lemme know if this was useful to you.

brother use background-size: 100% 100%; your style will be like

 div { 
        background-size: 100% 100%;
        background-repeat: no-repeat;
        border-radius: 50%;
        width: 200px;
        height: 200px;
    }

demo link: http://jsfiddle.net/vNh8t/314/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!