Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Thanked 0 Times in 0 Posts

    Desperate need in help for simple design layout (css & html)

    I'm a beginner in HTML and CSS. I'm trying to build a basic design, but I am having many difficulties with alignment.

    Here are the things I would like to do;

    - If this is possible, for the webpage to appear in the center of the screen.

    Here is my file (There are only three files and it's not huge):


    If anyone is willing to help, I would greatly appreciate it. Thank you so much.
    Last edited by Fathima786; 10-11-2012 at 10:38 PM.

  2. #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Thanked 1,874 Times in 1,858 Posts
    Hello Fathima786,
    Once you know how to center something -
    To center an element you need three things:
    1. a valid DocType
    2. an element with a width
    3. that elements right/left margins set to auto

    -you can put your site in a containing element and center it. Your code might look something like this then:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Fathima Designs</title>
    <style type="text/css">
    html, body {
    	margin: 0;
    	background: #d3f8ff;
    	font-family: Georgia;
    	text-align: center;
    	letter-spacing: 3px;
    #container {
    	width: 1000px;
    	margin: 0 auto;
    div#header {
    	height: 173px;
    	width: 1000px;
    	background: url("header.png"); no-repeat center;
    	div#header img {
    		float: left;
    		margin: 60px 0 0 50px;
    	#header a {
    		margin: 100px 100px 0 0;
    		display: inline-block;
    div#left {
    	height: 170px;
    	width: 200px;
    	float: left;
    	background: #fff;
    	margin: 25px 0 0;
    	ul {
    		padding: 0;
    		list-style: none;
    div#right {
    	height: 190px;
    	width: 148px;
    	margin: 25px 0 0;
    	float: right;
    	background: #fff;
    div#middle {
    	width: 517px;
    	margin: 25px 0 0 15px;
    	float: left;
    	background: #fff;
    	color: #46adba;
    div#footer {
    	width: 517px;
    	margin: auto auto 150px auto;
    a {
    	margin: 40px;
    	text-decoration: none;
        <div id="container">
            <div id="header"> 
            	<img src="logo2.png" alt="logo" width="215" height="88" /> 
                	<a href="home.html">HOME</a> 
                    <a href="about.html">ABOUT</a> 
                    <a href="contact.html"> CONTACT</a>
            <!--end header--></div>
                <div id="left">
                        <li><a href="design.html">DESIGN</a></li>
                        <li><a href="photography.html">PHOTOGRAPHY</a></li>
                        <li><a href="artwork.html">ARTWORK</a></li>
                <!--end left--></div>
            <div id="right"> Right column </div>
            <div id="middle">
                <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit...</p>
                <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit...</p>
            <!--end middle--></div>
            <div id="footer"> <a href="previousentries.html">Previous Entries</a> </div>
        <!--end container--></div>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use a DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts