css shapes - How to wrap text around a path defined in svg (using css)? -
my goal wrap text around shape defined svg.
the shape path looking rectangle 1/2 circular hole.
<svg width="100px" height="200px" viewbox="0 0 50 100"> <path id="halfcircleleft" d="m 50 26 ... z" style="fill: lightgray;"></path> </svg>
in html, define wrapping element <div>
<div class="svgleftshape"></div>
and set css this:
.svgleftshape { shape-outside: url(#halfcircleleft); float: left; width: 100px; height: 200px; }
should work, isn't it?
well, not working expected!
it sounds text wrapped around rectangle defined through css width , height. shape reference svg element ignored ...
what doing wrong?
in following fiddle, have added 'css' circle on right make sure not missing basics.
warning :
first, should know css shapes module level 1 actualy (april 2015) has status of "candidate recommendation". means work in progress, may change @ moment , therefore shape-outside should not used other testing.
this property actualy only supported chrome , requires -webkit-
vendor prefix haven't included in code.
here example will able view in chrome 37+ :
.shape { -webkit-shape-outside: circle(100px); shape-outside: circle(100px); width: 200px; height: 200px; float: left; }
<div class="shape"></div> <p>it includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body.</p>
using images shape-outside :
i not aware wether can use svg images or not. can use .png images , shape generated according transparency of image :
img{ -webkit-shape-outside: url(http://i.imgur.com/yzcqxf6.png); shape-outside: url(http://i.imgur.com/yzcqxf6.png); float: left; width: 100px; height: 200px; }
<img src="http://i.imgur.com/yzcqxf6.png"/> <p>it includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body. includes techniques such applying herbal-infused oils body, manual tissue manipulation, deep tissue work, identifying & acting on specific points, mobilizing joints, , warming body.</p>
note : if image has several levels of transparency, can control level defines outline of shape shape-image-threshold propery.
edit: use of svgs shape-outside property discussed in css shapes module level 2
Comments
Post a Comment