Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tony Groome 261 posts 804 karma points
    Feb 04, 2015 @ 17:18
    Tony Groome
    0

    How can I make an image round

    Hi All

    It's going well, but I am just wondering if there is a way to make an image round. The image is loaded by a user and displayed on a webpage. The code around the image is:

    var dynamicMediaItem = Umbraco.Media(apage.image);

                            <div class="home-page-box">

    <div class="column w110 ">

    <img src="@dynamicMediaItem.umbracoFile" alt="@dynamicMediaItem.Name" width="100" padding:5px 3px 5px 3px float:left/>

    </div>

    I have it floated left, is there a way to make it round?

    Thanks.

    Tony

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 04, 2015 @ 17:21
    Dennis Aaen
    100

    Hi Tony,

    You can do rounded corners of you images by adding this into your CSS

    .home-page-box .w110 img{
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    }

    With this style you will get 5px rounded corner on each side of the images, there is a generator here: http://border-radius.com/

    Hope this helps,

    /Dennis

  • Tony Groome 261 posts 804 karma points
    Feb 04, 2015 @ 17:26
    Tony Groome
    0

    Hi Dennis

    Wow that was easy, works a treat!! Just have to increase the radius to suit now! :) 

    Thanks a lot.

    Tony

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 04, 2015 @ 17:29
    Dennis Aaen
    0

    Hi Tony,

    You´re are welcome, you need different rounded corners of the sides, then the genrator can be nice to play with. The generator generates how the code should look like. It could be that you only want to have rounded corners on the left top and right top and so on.

    /Dennis

  • Tony Groome 261 posts 804 karma points
    Feb 04, 2015 @ 17:36
    Tony Groome
    0

    Hi Dennis

    That's cool I didn't notice you could set up each corner differently - that is really cool!!

    Tony

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 04, 2015 @ 17:52
    Jan Skovgaard
    0

    Hi Tony

    Just want to add that if you're going to make an image or a <div> or another element completely round the rule of thumb is to make sure the element has fixed height and width dimensions and then you can set the border-radius to 50% like this

    div{ height:100px; width:100px; border-radius:50%; }

    /Jan

  • Tony Groome 261 posts 804 karma points
    Feb 04, 2015 @ 18:06
    Tony Groome
    0

    Hi Jan

    Thanks for that. In my case I just made the width a fixed size to keep the scale of the picture, and let the height fill itself in.

    Thanks.

    Tony

Please Sign in or register to post replies

Write your reply to:

Draft