Centered Website With Fixed Width - ...begginers lesson...

free web hosting
Open Discussion > CONTRIBUTE > Tutorials

Centered Website With Fixed Width - ...begginers lesson...

rvovk
This will be tutorial on how to make a simple website design with fixed width and center position. This is actually rather simple tutorial, but hopefully it will help others that are new in world of creating websites. Website will also contain header, content area and footer.

First we must do Wrapper. Wrapper is actually an area of fixed width and will be position into center, so that our page doesn't fall apart.

CODE
body{
width:100%;
 margin:0px;
 padding: 0px;
 text-align:center;
background:#FFFFFF;
}


This is actually an IE5 hack were we did center align of everything that is inside of body. Meaning Wrapper will stay in center due the fact, that margin left and margin right – AUTO doesn't aplly for IE5. So this problem is solved.

CODE
#Wrapper{
 width:750px;
 text-align:left;
 min-width: 500px;
 margin:0px auto 0px auto;
 background:#FFFFFF;
   }


This is code for Wrraper. We used fixed width, margin are set to AUTO left and AUTO right, which will keep your site centered in browsers like Firefox, Opera, IE6.., new browsers actually. Next things that will be defined are Header, Content and Footer.

CODE
#Header{
 width:750px;
height:100px;  
background:#FFFFFF;
margin:0px;
padding:0px;
}


In this section we have defined Header properties. Width and height, margins and background. No big fuss.

CODE
#Content{
 width:750px;
background:#FFFFFF;
margin:0px;
padding:10px;
}


We have defined Content area so that it has 10 pixels of padding at top, meaning that Text will not be touching any borders of Content and will look more compact.

CODE
#Footer{
 width:766px;
height:25px;  
background:#FFFFFF;
margin:0px;
padding:0px;
}


Here we have defined Footer, which is 750px of width and 25px of height. No padding, nor margin.

CODE
p.text{
 font:11px/14px verdana, arial, serif;
color: #000000;
margin:0px;
padding:0px 10px 10px 10px;
text-align:justify;
}


This next thing is p.class for text. With classes you can define different styles of text (you are formatting it). Notice the padding-bottom, left and right of 10px. That means you don't have to use paragraph breaker, you just start with new area of same p.class and will show up like you use command break. Padding left and right gives space on left and right side of content. Font is defined as 11px of height with 14px of spacing (around 2px between lines in same paragraph), color is black (#000000).

So here we will make a CSS file and HTML file which is gonna be linked to a CSS file. CSS file serves as graphical presentation of our website and HTML builds and renders our actual website.

Here is the code of HTML file:

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Centered website with fixed width.</title>
<meta http-equiv="content-type" content="text/html;charset=windows-1250"/>
<style type="text/css" media="all">@import "layout12.css";</style>
</head>

<body>
<div id="Wrapper">
<div id="Header"><p class="text">Header</p></div><!--Header-->
<div id="Content">
<p class="text">Things in the future have changed dramatically.
I bought Canon A40 in year 2002 and took several interesting pictures with it.
Later I bought Sony DSC S-75 cause I liked its macro potencial.
But I sold it quickly cause it had lot of noise in images and awful white balance.
Just before end of year 2003 I bought myself second hand Canon G3 which I am still using.
Canon G3 is very good prosumer camera with pleasant results.</p>
<p class="text">Things in the future have changed dramatically.
I bought Canon A40 in year 2002 and took several interesting pictures with it.
Later I bought Sony DSC S-75 cause I liked its macro potencial.
But I sold it quickly cause it had lot of noise in images and awful white balance.
Just before end of year 2003 I bought myself second hand Canon G3 which I am still using.
Canon G3 is very good prosumer camera with pleasant results.</p>
<p class="text">Things in the future have changed dramatically.
I bought Canon A40 in year 2002 and took several interesting pictures with it.
Later I bought Sony DSC S-75 cause I liked its macro potencial.
But I sold it quickly cause it had lot of noise in images and awful white balance.
Just before end of year 2003 I bought myself second hand Canon G3 which I am still using.
Canon G3 is very good prosumer camera with pleasant results.</p>
</div><!--Content-->
<div id="Footer"><p class="text">Footer</p></div><!--Footer-->


</div><!--Wrapper-->


</body>
</html>


Here is CSS file (name it layout12.css, cause HTML is linked to this name of CSS file, but you can change it to your needs, but prior change the name of link to CSS file in HTML file):

CODE
body{
width:100%;
 margin:0px;
 padding: 0px;
 text-align:center;
background:#FFFFFF;
}

#Wrapper{
 width:750px;
 text-align:left;
 min-width: 500px;
 margin:0px auto 0px auto;
 background:#FFFFFF;
   }
   
#Header{
 width:750px;
height:100px;  
background:#B4A6A6;
margin:0px;
padding:0px;
}

#Content{
 width:750px;
background:#D0C9C9;
margin:0px;
padding:10px 0px 0px 0px;
}

#Footer{
 width:750px;
height:25px;  
background:#BB9999;
margin:0px;
padding:0px;
}

p.text{
 font:11px/14px verdana, arial, serif;
color: #000000;
margin:0px;
padding:0px 10px 10px 10px;
text-align:justify;
}


Notice: You can change your background colors or you can even change your colors into background images. All you need to do is to change code:

CODE
background:#code of color e.g. BB9999;


for Footer, into code:

CODE
background:url(images1/layout/content1.jpg) no-repeat;


where »images1/layout/content1.jpg« is relative path to your image for footer. You can do all of this for content, header and footer. NO-REPEAT means background is shown only once (for footer or header), whereas content can use command REPEAT-Y where backround is repeated vertically, command REPEAT-X will repeat background horizontally.

Working exaple of this tutorial is here.

CSS file is available here.

Any comments are welcome, maybe I have made some mistakes by myself, so that even I can learn out of this tutorial.

Best regards, hope you have enjoyed this tutorial,
Robert

 

 

 


Reply

Tyssen
Just a couple of points to make about some of your code:
You don't need to specify px (or anything else) if you're using a 0 value, e.g., margin: 0.
QUOTE(rvovk @ Aug 1 2005, 07:49 PM)
#Wrapper{
  margin:0px auto 0px auto;
    }
   
#Content{
padding:10px 0px 0px 0px;
}

You also don't need to specify the bottom and left properties of something if they're the same as top and right because B & L automatically inherit those properties. So instead of margin:0px auto 0px auto you can just type margin: 0 auto. In the case of padding:10px 0px 0px 0px, you'd type padding:10px 0 0: the L property takes its value from 0 specified for R, but because you want B to be 0 instead of 10, you have to specify that too.
Keep in mind that the order of properties goes clockwise: top, right, bottom and left.

Reply

rvovk
Cool, thanx mate. Now even I have learned some pointers. Especially about inherit thing. Never really bother myself with this option.
And yes, I forgot to write, when writing margin, padding or other properties, it goes like this: top, right, bottom, left.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : centered website fixed width begginers lesson

  1. My First Website - Where can i find useful web page templates? (1)
  2. Adding Your Website To Google - How to register with google (25)
    Hi everyone. Hopefully here im going to tell you how to register yourself with the Google search
    engine and get yourself in their results. Ill start the tutorial assuming you already have Meta
    tags or other search engine optimisation techniques in place. This tutorial is solely about
    registering with google. At one time i thought simply using meta tags etcetera would get you listed
    in Google, i then found out that didnt work, so i wondered why, and the fruits of my labour are what
    will go into this tutorial. the first step is to get a google account, this will get y...
  3. Programming In Glut (lesson 6) - Texture filters and lighting (2)
    This is the last of the six tutorials I have moved from astahost. I hope you enjoy these and the
    rest soon to come. QUOTE This tutorial demonstrates how to use texture filters and will let you
    see the differences of each filter. I will also be introducing lighting into this tutorial. We
    first have to create our "bitmap.h" header file with the functions we use to load our bitmaps, this
    is changed from the last tutorial to fit the needs of this one. The first thing to do is to link
    all of our OpenGL libraries and include our needed headers for the functions we w...
  4. Creating Navigation For Html Websites - Have a common navigation menu for the whole website! (12)
    Pre-requisite: HTML, inline frame tags 1 Attachment(.zip) included. Updates : 29-12-07: Doctype
    added in example files (Advised by jlhaslip) Designing a whole website takes a lot of planning
    and organization. Designing a proper navigation system is a basic step in building your website. If
    you are developing webpages in html you would have observed that as you go on creating pages it
    becomes difficult to maintain the links to the pages. This article will guide you in developing a
    common navigation menu for your website. It describes three ways, so if you don'...
  5. How To Setup A Website After Your Forum - (3)
    This tutorial is about how to setup a website after you have setup a forum. That means, you have a
    forum, and are wanting to add a website. This tutorial will show you how to create the website in
    your root directory(Example: http://domainname.com) , while your traffic gets redirected to your
    forum while you are creating it, until you're ready for guests to see it. This method is
    opposed to setting it up in another directory, then moving it(particularly more time consuming if
    you're site is PHP based). First of all, you are going to want to setup a redirect ...
  6. Css Scroll Bar Styles - Change the color of your website scrollbar! (1)
    REQUIREMENTS 1. Must have limited to good knowledge of CSS. 2. Must have limited to good knowlege
    of HTML. THE ELEMENTS First of all, there are 7 different elements of a scrollbar. a) Scrollbar
    Arrow Color /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" />
    Scrollbar Darkshadow Color c) Scrollbar Track Color d) Scrollbar Face Color e) Scrollbar Shadow
    Color f) Scrollbar Highlight Color g) Scrollbar 3dlight Color Bassically all that you need to do is
    change the colors like you normally do with any sort of CSS. Therefore, if you want the...
  7. Making A One Page Does All Website In Phph - (2)
    Hello and Great Day or Night either one. Have you ever been to a site and seen a index page or any
    page at all control everything such as index.php?do=home&action=logout something similar to the
    above? Well I am going to show you how easy it is to make this all own your own, and only have to
    use one web template or design to make it work. Before we get started you need to go ahead and find
    the web design that you want to use. After you find the site you want to use go ahead and save
    it... and save it like this so we can work together, ok! Note* We are going to ...
  8. Programming In Glut (lesson 5) - Texture mapping and keyboard controls (0)
    Lesson 5 of 6. These are beginning to be more advanced tutorials. If you are not familiar with my
    previous tutorials you may need to go back and read them. QUOTE In this tutorial I am going to
    teach you how to texture map your polygons and implement basic keyboard control. There is alot of
    new material in this tutorial and I hope I have explained it enough. Before you get started you
    will want to name a bmp file "image.bmp" or "image" depending on your computer settings (if one
    doesn't work then use the other) and place it in the same folder as your project....
  9. Programming In Glut (lesson 4) - Creating 3D objects (0)
    Lesson 4 of 6. I hope you are enjoying them /laugh.gif" style="vertical-align:middle"
    emoid=":lol:" border="0" alt="laugh.gif" /> . QUOTE Hello, in this tutorial we will be creating
    a 3D pyramid. We are building this tutorial from Lesson 3, but I took out the 2D objects and placed
    a 3D pyramid in there instead. The 3rd axis for drawing can be a litle confusing, but after you get
    the hand of it you'll do fine. Now when you are setting a 3D vertex just remember that the
    camera is on the positive end of the z axis. So things that have a more positive z axis va...
  10. Programming In Glut (lesson 3) - Animating your objects (0)
    Lesson 3 of 6. QUOTE In this tutorial I am going to talk about how to get animation in your
    program. I will be working directly off of Lesson 2 and will now take out the notes left behind
    from Lesson 1, but I will leave the notes from Lesson 2. CODE #include<glut.h>//include
    our glut library First we are going to initialize a variable called "time" which will record how
    much time has passed so we can use it to determine how to animate the objects. Then we have our
    init function that initializes some stuff in GLUT CODE float time = 0;//(NEW...
  11. Programming Glut (lesson 2) - Drawing 2D objects (0)
    This is the second of the six from astahost, again, I hope you enjoy. /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> QUOTE This is the second
    lesson in my series of tutorials on how to use GLUT to create graphics. In this tutorial I am going
    to be teaching you how to create different types of polygons. I am going to be adding on to last
    tutorial's code and will leave the notes in to help you remember what all the function are. I
    will also be noting the new functions that we will be using and how to use them. CODE #inc...
  12. Programming In Glut (lesson 1) - Creating a windwo (0)
    This is the first of six lessons I am transferring from Astahost for programming in GLUT, and after
    the six I hope to make more, I hope you enjoy. QUOTE Hello, I'm starting a series on how to
    program in OpenGL using the OpenGL Utility Toolkit, a.k.a. GLUT. I chose GLUT because it is quick
    and easy to write, and very easy to learn. In this tutorial I am going to teach you how to create a
    basic window which we will build off of in later tutorials. Throughout the tutorial I will leave
    notes to let you know what each command does, and how you can modify it to fit...
  13. Secure The Email Addresses On Your Website! - Wonderful script and useful! And working (10)
    Just follow the instructions below: /* Secure Email Function by Juan Karlo Aquino de
    Guzman Website: http://www.karlo.ph.tc and http://www.abs-cbn.ph.tc E-mail:
    http://www.karlo.ph.tc/send.php Usage: showEmail("support@microsoft.com",0); OR
    showEmail("support@microsoft.com",1); Types: 0 = ordinary random 1 = more secure random To
    include to a script: include_once("email_secure.php"); */ And here is the code :
    CODE <?php /*     Secure Email Function by Juan Karlo Aquino de Guzman     Website:
    http://www.karlo....
  14. Checking Dns Settings For Website - DNS Setting, Ping, Whois, Dnsreport etc (2)
    If you have recently purchased a domain and facing problems with the workings, the first thing which
    you should check is the DNS setting. Dns settings determine, how to domain is pointed to the Server
    and How the server is connected to the world (internet). Ensure, the DNS settings are perfect to
    make sure, things work smoothly and people across the globe don't have problems accessing your
    site. The basic check would be : PING Suppose you register your domain (example.com) at
    ComputingHost. You get an IP for your website. In this case, suppose its 64.69.35.170. Yo...
  15. Configuring Dns Settings For Website - Nameserver, A-Address, DNS configuration (1)
    Most of the people have problems configuring their website. After registering their domain, many get
    confused in configuring their domain (basically the DNS settings). This small tutorial will help you
    get started with DNS settings configuration. A domain can be basically pointed to a server using 2
    main techniques. 1. Nameserver (the most recommended way) 2. A Address (Not recommended)
    Configuring using Nameservers ==================== Login to your domain Control panel provided by
    your DOMAIN NAME PROVIDER / REGISTRAR. Not your webhost. Search for settings like DN...
  16. Introduction To Templating - Templating your website with PHP (1)
    Pre-note Hello and welcome. if your website doesn't use a templating function, you may have
    noticed it's pretty hard to update your website (layout) unless you dig through many files to
    update the images and such. The solution is templates. If you ever got curious and looked into
    phpBB codes or any other template based forum/CMS, you saw the .tpl files they use. I am not at a
    point where i base everything on .tpl (simply because i havent taken the time to see how it all
    works). But i do can tell you that it's the same principle, template your site using an...
  17. E-mail Mailer Script 0.1 - useful for website visitors (4)
    Are you pissed off when you are putting e-mail in your website, you always get spammers? Well,
    here's the solution. Just change the default variables to anything that you like, etc... follow
    the instructions on the script.. Here it is... hope you like it /smile.gif' border='0'
    style='vertical-align:middle' alt='smile.gif' /> CODE <?php //E-mail Mailer Script 0.1
    by Juan Karlo de Guzman //FOR TRAP17 ONLY... DEMO VERSION... DO NOT DISTRIBUTE
    header("Content-type: text/html; CHARSET=UTF-8");
    $int_rand=mt_rand(1,20); if&#...
  18. Centered Website With Two Columns - CSS (12)
    This is upgrade of my first tutorial for Centered website with fixed width. Today I am going to
    present you tutorial for making two columns website with fixed width. My basic tutorial can be found
    here: here. So let's begin: First we will change CSS file, everything stays same if not
    mentioned to change, starting with color of content from basic tutorial, change background to this
    code. This will actually be background of left column and padding will be set to 0, cause it will be
    defined in Left and Right column. New code for Content: CODE #Content{  width&...
  19. Making A Website - Also Some Dos and Don'ts (6)
    I had originally had this posted on my domain at nevernormal.com, and thought that you guys could
    use it here as well. Granted, this is geared to the uber newbie, so don't razz me if I
    don't suggest the most advanced in web design. lol So, you want to make a website? 1.
    First, think about what you want your site to be about. There are fanfic sites, like Drastic
    Measures and fanfiction.net ; cliques or clubs, like the BtVS Writers' Guild ; or, if you
    want, you could have a general site, whether it be about a show/movie you like, or even just about y...
  20. [tutorial] Skinning Your Site - a tutorial on how to skin your website (2)
    For this tutorial you are going to need to know how to use php includes. You are also going to need
    to rename all o your files to a .php extension. In your FTP or Cpanel make a folder in your public
    (main) directory and name it "skins". In the skins folder make another folder named "1". In the
    folder you names skins make a file called cookiecheck.php. Copy the code below and paste it into the
    cookiecheck.php file. $total_skins = 1; $default_skin = 1; if (isset($_REQUEST
    )) { $newskin=(int)$_REQUEST ; if ( ($newskin $t...



Looking for centered, website, fixed, width, begginers, lesson

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for centered, website, fixed, width, begginers, lesson

*MORE FROM TRAP17.COM*
advertisement



Centered Website With Fixed Width - ...begginers lesson...



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE