Forum Moderators: open
<div id="container">
<span style="width: 50px"></span>
<span id="text_container" style="padding: 0 25px">PotentiallyLongTextWithNoBreaks</span>
<span style="width: 85px"></span>
</div>
<script>
var container_width = document.getElementById('container').offsetWidth;
var maximum_width = screen.width;
while (container_width > maximum_width) {
var text_size = document.getElementById('text_container').style.fontSize;
text_size = text_size.replace('px', '');
text_size -= 1;
document.getElementById('text_container').style.fontSize = text_size + 'px';
}
</script>
you really need to read, understand and practise
all the information that may be found here...
How to use media queries [google.co.uk]
<style type="text/css">
#text_container, H1 { font-size: 42px }
@media only screen and (max-width: 360px) {
H1 { font-size: 75% !important }
}
</style>
<div id="container">
<span style="width: 50px"></span>
<span id="text_container" style="padding: 0 25px">
<H1>PotentiallyLongTextWithNoBreaksM/H1>
</span>
<span style="width: 85px"></span>
</div>