Solved

Automatically resize IE to fit text

Posted on 2003-11-04
3
346 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
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 50 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now