admin管理员组文章数量:1026380
I've made a parallelogram using CSS3's skew
transform, and placed text within another div that has an opposite skew
value so that the text remains un-transformed: JSFiddle example.
Is there a way to have the text aligns to the edges of the parallelogram like this:
I'm open to other suggestions, such as using the canvas
if it's not possible using CSS. If there is a JavaScript technique to do this then any links that may be useful would be appreciated.
UPDATE: After hunting for some cross-browser solutions, the easiest tool I found to achieve this was with this tool.
I've made a parallelogram using CSS3's skew
transform, and placed text within another div that has an opposite skew
value so that the text remains un-transformed: JSFiddle example.
Is there a way to have the text aligns to the edges of the parallelogram like this:
I'm open to other suggestions, such as using the canvas
if it's not possible using CSS. If there is a JavaScript technique to do this then any links that may be useful would be appreciated.
UPDATE: After hunting for some cross-browser solutions, the easiest tool I found to achieve this was with this tool.
Share Improve this question edited Feb 2, 2015 at 8:47 James Craig asked Nov 6, 2014 at 11:28 James CraigJames Craig 6,87410 gold badges48 silver badges77 bronze badges 4- I think you should try rotating the text as: jsfiddle/jm1wqemL/1 – Vicky Gonsalves Commented Nov 6, 2014 at 11:31
- 1 @VickyGonsalves - the problem with that is that it's clearly skewed the content too – user1017882 Commented Nov 6, 2014 at 11:32
- @DeeMac great find! Could you put that into an answer for other people who are looking for the same thing as me? I had a frustrating few hours trying different search terms and nothing useful came up. – James Craig Commented Nov 6, 2014 at 12:50
- That link in the updated question is not working any more. – Abdalla Arbab Commented Jan 15, 2018 at 12:48
1 Answer
Reset to default 5As requested, your answer lies in the use of -webkit-shape-inside
: http://hongkiat./blog/css3-content-wrapping
Define a polygon
with the points that match your parallelogram and your content will fit that shape.
TIP: To get the 'points' of your shape, export it as a vector from suitable graphics design software and in the SVG will be the coordinates.
I've made a parallelogram using CSS3's skew
transform, and placed text within another div that has an opposite skew
value so that the text remains un-transformed: JSFiddle example.
Is there a way to have the text aligns to the edges of the parallelogram like this:
I'm open to other suggestions, such as using the canvas
if it's not possible using CSS. If there is a JavaScript technique to do this then any links that may be useful would be appreciated.
UPDATE: After hunting for some cross-browser solutions, the easiest tool I found to achieve this was with this tool.
I've made a parallelogram using CSS3's skew
transform, and placed text within another div that has an opposite skew
value so that the text remains un-transformed: JSFiddle example.
Is there a way to have the text aligns to the edges of the parallelogram like this:
I'm open to other suggestions, such as using the canvas
if it's not possible using CSS. If there is a JavaScript technique to do this then any links that may be useful would be appreciated.
UPDATE: After hunting for some cross-browser solutions, the easiest tool I found to achieve this was with this tool.
Share Improve this question edited Feb 2, 2015 at 8:47 James Craig asked Nov 6, 2014 at 11:28 James CraigJames Craig 6,87410 gold badges48 silver badges77 bronze badges 4- I think you should try rotating the text as: jsfiddle/jm1wqemL/1 – Vicky Gonsalves Commented Nov 6, 2014 at 11:31
- 1 @VickyGonsalves - the problem with that is that it's clearly skewed the content too – user1017882 Commented Nov 6, 2014 at 11:32
- @DeeMac great find! Could you put that into an answer for other people who are looking for the same thing as me? I had a frustrating few hours trying different search terms and nothing useful came up. – James Craig Commented Nov 6, 2014 at 12:50
- That link in the updated question is not working any more. – Abdalla Arbab Commented Jan 15, 2018 at 12:48
1 Answer
Reset to default 5As requested, your answer lies in the use of -webkit-shape-inside
: http://hongkiat./blog/css3-content-wrapping
Define a polygon
with the points that match your parallelogram and your content will fit that shape.
TIP: To get the 'points' of your shape, export it as a vector from suitable graphics design software and in the SVG will be the coordinates.
本文标签: javascriptCSS Parallelogram with TextStack Overflow
版权声明:本文标题:javascript - CSS Parallelogram with Text - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745641693a2160785.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论