[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Automatically resize IE to fit text

Posted on 2003-11-04
3
Medium Priority
?
355 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…
Suggested Courses

834 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