What is and is there a way scale text using CSS based on the amount of text within a DIV.
I've this page I've created at http://www.directiongroup.com/tweethearts/ and the CSS for the text is (with a fixed size of 32px):
.jta-tweet-text
{
color: #ed1c24;
font-size: 32px;
text-transform: uppercase;
line-height: 30px;
font-weight: normal;
font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
text-shadow: 0px 1px 0px #FFFFFF;
}
Many Thanks
You can't do this with CSS alone but you could do it with a bit of JavaScript.
Counting the number of characters in the text and setting the CSS font-size
property as required.
Here's a quick example using jQuery: http://jsfiddle.net/pjByL/
$('.heart').each(function(){
var textLength = $(this).text().length
if(textLength > 26)
{
$(this).css('font-size', '10px');
}
});
You can't achieve that with css
you have to use java scrip
t for this check this may that's help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With