Alt-web

 

More on this site

Alt-Web Home Page

Chalk Board Intro

NEW Formmailer-Tutorial

NEW Tooltips on Image Maps Tutorial

NEW Cushy CMS with NOF

Custom CSS Links

CSS Styled Background Images

Image Borders on Mouse Over

Iframes

Print Page Buttons

Close Window Buttons

Scrollable Divisions

CSS Flyout Menus

Vertical & Horizontal Centering

Centered on Two-toned Background Image

Liquid Layouts

Images and Text

Layout Regions

Printer Friendly Pages

Web Color Assist Tool

Hex Color Chart

Favicons

Fast Contact Forms

Table Menu

 

banner

Vertical & Horizontal Centering in NetObjects Fusion

Description:

This gets asked a lot in the NOF newsgroups. "How do I center my page horizontally and vertically?" In fact, this poses a challenge for most web designers because there are no valid Vertical Center tags in HTML or CSS. So we have to trick browsers into doing what we want.

At first we tried doing this with tables nested inside tables. This can give the illusion of padding on the top, bottom and sides of pages but it fails the litmus test for true vertical & horizontal alignment.

Next, we created a liquid layout on a zero margins border. Then by adding one absolutely positioned division with a little CSS code inside the middle table cell, we got a box that appears Horiz/Vert centered on the page. Not ideal for an entire web site but it could be useful as an intro page, business card or form,  View Sample

Tutorial:

  1. Create a new page with zero margins.
  2. Place a text box on the page.
  3. Add a 3 x 3 table to the text box. 
  4. Stretch the text box to the width of your page layout.
  5. Set text box properties to "Size layout to text" and "Contents wrap to browser width."
L-Fig2
  1. Set table properties height and width to 100%. 
  2. Set cell padding, cell spacing and borders to 0. 
  3. Deselect "Generate Non-Breaking Spaces"
HV-cent-table
  1. Double click inside the middle table cell as if to type text.
  2. Hit Ctrl+T to bring up an HTML insertion box.
  3. Copy the following code and paste it into the the HTML box.

<div style="border: solid 2px #99CCFF; background-color: #FFCC99; height: 50%; width: 50%; position: absolute; left: 25%; top: 25%; color: #660000; overflow: auto; padding:10px;">
<h1>Your Heading goes here</h1>
Normal text goes here. <br><br>
Set *overflow* to auto in case content exceeds the height or width of user's viewport. <br><br>
This is dummy text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In sagittis. Nulla dictum, dui vitae egestas estibulum, tellus eros tincidunt lorem, ac commodo arcu nisi ac libero. Suspendisse interdum laoreet libero. Etiam auctor neque at libero. The end.
</div>

  1. For best results use the same or matching color settings for page background, text box and table background.
  2. Finally, adjust the Hexidecimal # Color Codes inside your division box to match your site's color scheme. Or use this handy Color Picker Tool to help with color selection.

That's all there is to it. We hope you found this tutorial fun and helpful.


 

Reach the World with Alt-Web

If you use the free content on this site and you cannot make a small donation, we would appreciate it if you would place a link on your site to ours.

Help feed the kitty

 

Visit our Free Reciprocal Link Exchange Page. Thank you.

© 1995 - 2009 Alt-Web Design and Publishing
Nancy O'Shea