CSS Centering

CSS CenteringThis tutorial will show you how to center you website design in all browsers.

Step One

Create a website design, once you've created your layout in Photoshop. You need to code it and save it into the correct format. Example: .php, .html, .asp

Step Two

Create a CSS Stylesheet and link to it in the top of your design, use the code below to link to an external stylesheet. Save the style sheet as "style.css".

You need to paste the below code into the < head > tag of your page.

<link media="screen" type="text/css" href="style.css" rel="stylesheet">

Step Three

Add the below CSS into your CSS document: This code instructs both browsers to center anything inside the tags to be centered.

body
{
text-align: center; */ Centers in IE */
}
#container
{
margin: 0 auto; */Centers in FF */
}

Step Three

You now need to add the below code into the design you created.

You need to replace the " with the body part of your design.

<body>
<div id="container">
<!-- Content Here -->
</div>
</body>

Finished

That’s it! Everything inside those two tags will be centered in the middle of the window in both Internet Explorer and Firefox.

I hope this helps!


Close    To Top
  • Prev Article-Web Design:
  • Next Article-Web Design:
  • Now: Tutorial for Web and Software Design > Web Design > HTMLCSS > Web Design Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction