Connecting Tech Pros Worldwide Forums | Help | Site Map

specify page size on load

jamesd0142's Avatar
Needs Regular Fix
 
Join Date: Sep 2007
Location: Wales
Posts: 467
#1: Apr 9 '08
For reasons i wont go into (they'll bore you...) i need to have a link on our system that opens up a web page, I dont have frontpage or simular products installed, so im likely to use a text editor and rename the file '.htm'.

What i would like is to be able to create a page and specify the size when it loads.

for example can i say maybe in the head section:
page width = '100'
page height = '100'

is there anything such as this that can be done?

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,566
#2: Apr 9 '08

re: specify page size on load


This would come under presentation so use CSS. You would put this in the <head> of your page:
[html]
<head>
<style type="text/css">
body { width:100px; height:100px }
</style>
[/html]

Remember to include 'units' for the size. In this case, px.
jamesd0142's Avatar
Needs Regular Fix
 
Join Date: Sep 2007
Location: Wales
Posts: 467
#3: Apr 9 '08

re: specify page size on load


So i have code like this...?

Im extremely new to html..!

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2.   <HEAD>
  3.     <TITLE>WBL Downloads</TITLE>
  4.  
  5. <style type="text/css">
  6. body { width:100px; height:100px }
  7. </style>
  8.  
  9.  
  10.   </HEAD>
  11.   <BODY>
  12.     <H1>WBL Support Documents</H1>
  13.     <P>Downloads</P>
  14.  
  15. <hr>
  16. <b>Welsh Learning Aims Database</b> <p>
  17. (Zip file contains an access file with extension ‘.mdb’)
  18. <p>
  19. Download: <A HREF="WLAD.zip">WLAD.zip</A> 
  20. <hr>
  21.  
  22.  
  23.  
  24.   </BODY>
  25. </HTML>
Thanks James
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,566
#4: Apr 9 '08

re: specify page size on load


Sort of. The body has to contain all of the elements so it will expand to do that. You can reshape it, to some extent, by controlling height and width. Play with that to see what happens.

It might be better for you to just wrap the entire contents in a <div> and shape that instead. That may be easier overall.

Also, you should get in the habit of using lower case for all your elements. HTML doesn't care but CSS does, XHTML does, as does a lot of stuff on the internet, programming stuff, and so on.

You need a doctype. Without one, IE will go into 'quirks mode' and all hell breaks loose. Make sure you use a modern, standards compliant browser to test in first. IE is NOT a modern, standards compliant browser. Use Firefox/Opera/Safari. Then check to see if IE manages to do it right.

Validate your html AND your css early and often to check for errors.

Much of that has an article under "Howtos" at the top of this page in hte html/css section.

Anyway....This should be what your markup looks like:
[html]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>WBL Downloads</TITLE>

<style type="text/css">

body { width:700px; height:50px }
</style>


</HEAD>
<BODY>
<div id="wrapper">
<H1>WBL Support Documents</H1>
<P>Downloads</P>

<hr>
<b>Welsh Learning Aims Database</b>
<p>
(Zip file contains an access file with extension ‘.mdb’)
</p>
<p>
Download: <A HREF="WLAD.zip">WLAD.zip</A>
</p>
<hr>

</div>


</BODY>
</HTML>
[/html]

Note that I specified which "character set" you are using. You include the utf-8 charset, which is the one you should be using, but you need to declare it, as done above.
Reply