?
Solved

Automatically resize IE to fit text

Posted on 2003-11-04
3
Medium Priority
?
354 Views
Last Modified: 2008-02-01
Good day

I have this header in my html page , e.g. STANS REPAIR SHOP
I have set this html page size to say 500,400
If i open this page after i tested it , it says "STANS REPAIR SHOP" proudly left in the page
However when someone on another pc opens  it. it says
"STANS REPAIR
 SHOP"

how can i set IE to automatically resize the page so that the "STANS REPAIR SHOP"
will always display in its full length?
0
Comment
Question by:jxharding
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:monvelasquez
ID: 9685002
you can use javascript when the page loads...

<HTML>
...
<body onload="resizeTo(500,400);">
...
</body>
</HTML>
0
 
LVL 11

Accepted Solution

by:
Zontar earned 150 total points
ID: 9685786
People don't usually like having their browser windows resized for them.

Here's a better solution -- resize the text to fit the user's window:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>

<style type="text/css">
  h1#pageTitle  {font:bold normal 15px Arial,Helvetica,sans-serif; text-align:center;}
</style>

<script type="text/javascript">

window.onload = fitHeading;
window.onresize = fitHeading;

function fitHeading()
{
  var adjust = 12;
  var heading = document.getElementById("pageTitle");
  var pageWidth = document.body.offsetWidth;
 
  heading.style.fontSize = Math.floor(pageWidth/adjust) + "px";
}
</script>

</head>
<body>
<h1 id="pageTitle">STAN'S REPAIR SHOP</h1>
</body>
</html>

Change the value for the "adjust" variable to get it just the way you want it.

Works in MSIE and Mozilla -- should work in all the version 5 and higher browsers.
0
 

Author Comment

by:jxharding
ID: 9685842
thanks a lot! , will try & accept
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question