I want to make rounded images like this I have searched and googled but I did not find any solutions to make image rounded.I can do images rounded border like this but I dont know how to make the image itself rounded.Please help
Try this, Change radius by adjusting height and width. height and width should be equal and double of the radius you required
HTML :
<div id="round">
</div>
CSS :
#round{
height:100px;
width:100px;
border-radius:50%;
background:green;
overflow:hidden;
}
Fiddle Demo / updated
Check this for responsive circle DEMO
Use border-radius to achieve what you are looking for.
WORKING DEMO
The code:
img{border-radius:50%;}
If you specifically want a white box with a rounded image in it, you simply make a div with the said width & height you want.
Give it a background color and a border of 1px in the same background color.
Then in the div place an image with borderradius of 50% and width and height of 100% to fill the box and you're done.
Try this: http://jsfiddle.net/fWwgD/
<style type="text/css">
body
{
background-color:black;
}
#box
{
width:300px;
height:300px;
background-color:white;
border: 1px solid white;
}
.circle
{
border-radius:50%;
width:100%;
height:100%;
}
</style>
<div id="box">
<img src="https://www.gravatar.com/avatar/01f40d1a1219433e2f7ab40fab531142?s=32&d=identicon&r=PG&f=1" class="circle">
</div>
Related
This is a screenshot of it. I want the label and the image both to fit inside the blue div
I want both of them to fit inside the blue div. But nothing i did worked. I read i should have them float left/right but it stills have the blank space. Set the margin on 0. Still the blank space. The only thing that removed the blank space was line height on 0px. But this messed up the label placement. So i am kinda lost on this one
Html :
<div class="playerInfo">
<div class="playerChamp">
<img src="profileIcon10.jpg" width="100" height="100" >
<div class="playerName">
<label for="male">Male</label>
</div>
</div>
</div>
css
.playerInfo {
height:120px;
width:130px;
background:blue;
border:solid 1px black;
}
.playerChamp {
width:100px;
height:100px;
background :red;
}
.playerName {
width:100px;
height:20px;
background :red;
}
add margin-top: -4px; to .playerName will pull it up and you won't have the space between the two divs.
SEE THE FIDDLE
I am trying to create responsive circle which fit on every screen size like this:
I tried some codes from but anyone not work properly according to requirement.
You should do it with SVG or 2x res PNG. It will be approximately the same size regarding bandwith but you'll get a better control and much faster render.
Try something like this:
<div class="container">
<div class="circle">
<img class="image" src="http://lorempixel.com/800/800/">
</div>
</div>
.container {
width: 100%;
background: #000;
}
.circle {
border-radius: 50%;
width: 100%;
padding-bottom: 100%;
background: #fff;
position:relative;
overflow:hidden;
z-index:2;
}
.image {
z-index:1;
position:absolute;
top:0;
left:0;
width:auto;
max-width:100%;
height:auto;
max-height:100%;
}
The circle should fit the container..
see on fiddle: http://jsfiddle.net/jimmynewbs/doan8b2f/
You can then create a div inside this for the text / image and set the image to a maximum width of 100% and width auto. this will make sure it doesn't get bigger than the circle. Positioning the image absolute can help keep it within the circle too if you wanted to make it expand out to the edges...
In my page I have a menu icon on top left corner, and it is wrapped inside a circle, SO I used CSS3 border radius.
But the circle is not that smooth and I am getting some distortion along the corner. Is there any way to make it smooth.
If the height and width increased, I am getting the circle shape without distortion.
#container{
width:400px;
height:400px;
background:#000;
padding:100px;
}
#circle{
width:40px;
height:40px;
border-radius: 50%;
border:1px solid white;
}
<div id="container">
<div id="circle"></div>
</div>
Read this
http://www.sitepoint.com/how-to-get-smoother-rounded-corners/
and do lemme know if this helps
I cropped an image in html & css . When i am coding a <span> tag the cropped image displayed. But I need to know how can I modify it.
I have the following code:
<style type="text/css">
.design {
padding-left:25px;
background:url('Flings.png') no-repeat top left;
display: inline-block;
height: 17px;
width: 0px;
margin-left: 550px;
}
</style>
<div style="height: 200px;">
<span class="design" style='font-size: 40px;'></span>
</div>
When I am using the span tag, the cropped image displayed. But I want to modify it.
Example:
<span class="desgin" style='color: red;'></span></h3>
I want to color the image itself and change it's size and I am little stuck here.
Hope you understood me well, I will be glad for any help.
Thanks!
So you want to scale and then colorise the image? You can scale the image using background-size but this isn't very well supported. CSS3 filters unfortunately don't have a colorize filter also.
You should do this using an <img> so scaling works without background-size and then use another transparent element on top of the image to provide the tint effect. Unfortunately <img> tags don't support pseudo-elements so need to use a wrapper.
jsFiddle
HTML
<div class="red-tint">
<img src="https://www.google.com.au/images/srpr/logo4w.png" />
</div>
CSS
img {
/* scale the image */
width:200px;
height:auto;
}
.red-tint {
position:relative;
display:inline-block;
}
.red-tint:after {
background: rgba(255, 0, 0, 0.5);
display:block;
content:"";
position:absolute;
left:0;
right:0;
top:0;
bottom:0;
z-index:1;
}
Update
Ah you want to crop, then that's just a matter of using background-position. You will need to give negative left and top positions to background-position which represent the offsets from the top-left corner of the image. For example, this will draw a 200x100 chunk of the image which is 100px in from the left side of the image and 20 px down from the top.
jsFiddle
.design {
width:200px;
height:100px;
background:url(https://www.google.com.au/images/srpr/logo4w.png) no-repeat;
background-position:-100px -20px;
}
I have to put a background image in a div, if i put only image, it will not show. if i put only height it will be shown.
so in this way it will be shown:
<div id="big" style="background-image:url('base1.png');height:200px;"></div>
if i want to position div and resize image in this way
<div id="big" style="background-image:url('base1.png'); left:519px; top:423px; width:474px; height:205px; z-index:4"></div>
it will be not shown. what can i do? can you help me?
use css
<div id="big"></div>
#big {
display:block;
width:300px;
min-height:300px;
background : url('img/image.jpg') no-repeat 50px 50px;
}