Customizing text flow to wrap around irregular borders can enhance the visual appeal of your website or application. This article explores a method proposed by Tory Lawson in his 2011 blog post, "Wrapping text around non-rectangular shapes."
Using an image editing program, determine the desired text boundary by drawing a bounding line that represents where the text should end.
Measure the width of the wrap area at regular intervals (e.g., every 10 pixels). Record these values to serve as the widths of the spacer divs.
Markup:
<body> <div>
CSS:
#wrapper { width:634px; height:428px; display:block; background-image:url("headshot.jpg"); } .spacer{ display:block; float:right; clear:right; } p { display:inline; color:#FFF; }
This technique floats divs to block off the shape's area, allowing the text to wrap around the non-rectangular image while maintaining a consistent distance from its borders.
Wrapping text around non-rectangular images requires a custom approach. While there is no direct CSS solution, the method described in this article can effectively achieve the desired effect.
The above is the detailed content of How to Wrap Text Around Irregular Images Using CSS and Divs?. For more information, please follow other related articles on the PHP Chinese website!