?
Solved

Automatically resize IE to fit text

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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

770 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