Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Bruno Dias
10,554 PointsText and paragraph proportional to div width
Hi,
Is there a way to make the font-size and paragraph height change according to div width?
2 Answers
Craig Watson
27,930 PointsHi Bruno,
Im sure if it was a must you could use jQuery to track the specific elements width and then use if statements to control the css properties at your chosen div widths .....
However this seems a little excessive for something that could be done using a couple a media queries at the right points..
It would definitely depend on your own opinion to whether this was totally necessary :)
Hope this helps
Craig
Bruno Dias
10,554 PointsHi Craig,
Yes I end up using a Jquery plugin to achieve that. The plugin that I used is this one: https://github.com/marcj/css-element-queries (really good one by the way).
Thank you for your help mate.
Craig Watson
27,930 PointsThanks Bruno I've Bookmarked the link thank you !