I know i can adjust the font size, but I want it to shrink to fit the div automatically when it is viewed on a different platform which reads font sizes differently for example.
See the fiddle: http://jsfiddle.net/08pyzgx4/
<body>
<div style="width:600px; height:58px; max-width: 600px; background-image:url(http://itrace.co.za/images/emailfiles/banner.png); background-repeat:no-repeat; display:block; max-width: 600px; font-family:Arial, Helvetica, sans-serif; font-size:19px; color:#000; text-align:center; padding-top:12px;"><b>Bla Bla Bla Bla Bla Bla </b>
<div style="height:16px; max-height:16px; padding-left:88px; padding-right:88px; margin-top:18px; font-size:0.6em; letter-spacing:-0.02em; position:relative;"><strong>Website: </strong>www.blabla.co.za | <strong>E-mail: </strong>[email protected] | <strong>Control Centre: </strong>08600-22-blabla</div>
</div>
</body>
You can do it like this....and don't forget to add js library.
this is the fiddle...http://jsfiddle.net/f6sx474j/ Try by increasing the text i checked it and its working properly.
<div style="width:600px;
height:58px;
max-width: 600px;
background-image:url(http://itrace.co.za/images/emailfiles/banner.png);
background-repeat:no-repeat;
display:block; max-width: 600px;
font-family:Arial, Helvetica, sans-serif;
font-size:19px; color:#000;
text-align:center; padding-top:12px;">
<b>Bla Bla Bla Bla Bla Bla </b>
<div id="abc" style="height:16px;
display: inline-block;
max-height:16px;
padding-left:88px;
padding-right:88px;
margin-top:18px;
font-size:0.6em;
letter-spacing:-0.02em;
position:relative;">
<strong>Website: </strong>www.blabla.co.za |
<strong>E-mail: </strong>
[email protected] [email protected] info@b
<strong>Control Centre: </strong>
08600-22-blabla</div>
</div>
//And this is your js
<script type="text/javascript">
$(function() {
var div = $('#abc');
var fontSize = parseInt(div.css('font-size'));
do {
fontSize--;
div.css('font-size', fontSize.toString() + 'px');
} while (div.width() >= 400);
});
</script>
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