Jump to content

Circular image with circular text around it
   (0 reviews)

Kit the Human
  • When I have a circular image, I want the text around it to curve with it. Here's a quick guide to doing that!

    Type: Look & Feel

When I make an image circular, I find this annoying:

 

before.PNG

 

Circular image? Square text? Annoying. I would much rather do this:

 

after.png

 

Text curving with the image? Much nicer. Thankfully, it's also super easy to pull off.

 

<div class="container">
  <img src="image" />
  Lorem ipsum, your text would be here!
</div>

This is what your mark up will look like. A container that holds your image and text.

 

Then your CSS:

 

.container img {
  float: left;
  border-radius: 100%;
  shape-outside: circle(50%);
  margin: 0 5px 5px 0;
  height: 200px;
  width: 200px;
}

 

  • You want to float the image to the left, because it tells the text to wrap around it.
  • You want to add in the border radius to make the image into a circle.
  • Shape-outside is the magic. It tells the text outside of the image to make a circular shape around the image.
  • Margin is just some spacing and the height and width are self-explanatory.

 

And that's it! Simple and snazzy.


  • I read this! 1



User Feedback

Create an account or sign in to leave a review

You need to be a member in order to leave a review

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

There are no reviews to display.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.