Results 1 to 6 of 6

Thread: html help please

  1. #1
    Gatekeeper of Strong Wind syun_ukiya's Avatar
    Join Date
    Jul 2001
    Location
    .A N I M E E X E
    Posts
    434

    Default html help please

    attached is a sample website, but i want to make it center, ive tried everything but it does not work, any ideas?

    thanks in advance
    Attached Files Attached Files

  2. #2
    Very VIP person Tech Admin Rantz's Avatar
    Join Date
    Apr 2006
    Posts
    17,631
    Articles
    1

    Default

    This is a very outdated table-based layout, and a pretty messily coded one at that. First and foremost, I would urge you not to use this at all but to find another sample layout - one that is based on correctly used HTML (or XHTML) and CSS. This is damn near impossible to work with in the long run.

    If you're still dead set on using this layout, I did manage to center it with some trouble. It's an ugly solution, but that's to be expected when manipulating a layout like this. It still needs some adjustments, but it's too time demanding to fix every detail.

    I still say you should scrap this and get a good sample layout instead. If not - hope this helps.
    Attached Files Attached Files

  3. #3
    Gatekeeper of Strong Wind syun_ukiya's Avatar
    Join Date
    Jul 2001
    Location
    .A N I M E E X E
    Posts
    434

    Default

    thanks for taking the time to try it, yeah i think its a bit messy to center.. hmm what if i'll just increase the width of the left windows the one with the news and contact and just increase the picture sizes, will that be workable? i tried changing the widths but i cant seem to increase the left side

  4. #4
    i n v i s i b l e Tech Admin o_O's Avatar
    Join Date
    Jun 2001
    Location
    New Zealand
    Posts
    2,957
    Blog Entries
    1

    FFXIV Character

    Humphrey Squibbles (Sargatanas)

    Default

    I think what Rantz is saying is that if you use this website as a cornerstone for your web-development knowledge, you're going to have a very poor set of skills. And he's right; you should be investigating table-less layouts, which often use &lt;div&gt; elements instead of &lt;table&gt; ones. If you can't be bothered reading why, then click <a href="#lol">here</a> to skip to the answer to your question.

    This is one of the the most basic of table-less layouts, which can be expanded upon pretty easily:
    PHP Code:
    &lt;html&gt;
        &
    lt;head&gt;
            &
    lt;title&gt;Page&lt;/title&gt;
            &
    lt;style type="text/css"&gt;
                
    body {
                    
    font10px Verdana;
                }
                
                
    #container {
                    
    margin0 auto;
                    
    width608px;
                    
    border1px solid yellow;
                }

                
    #header {
                    
    height40px;
                    
    border2px solid blue;
                    
    background#AAAADD;
                
    }

                
    #menu {
                    
    height200px;
                    
    width150px;
                    
    border2px solid red;
                    
    background#DDAAAA;
                    
    floatleft;
                }

                
    #body {
                    
    height200px;
                    
    width450px;
                    
    border2px solid green;
                    
    background#AADDAA;
                    
    floatright;
                }

                
    #footer {
                    
    height40px;
                    
    border2px solid aqua;
                    
    background#AADDDD;
                    
    clearboth;
                }
            &
    lt;/style&gt;
        &
    lt;/head&gt;

        &
    lt;body&gt;
            &
    lt;div id="container"&gt;
                &
    lt;div id="header"&gt;Header&lt;/div&gt;
                &
    lt;div id="menu"&gt;Menu/navigation&lt;/div&gt;
                &
    lt;div id="body"&gt;Body&lt;/div&gt;
                &
    lt;div id="footer"&gt;Footer&lt;/div&gt;
            &
    lt;/div&gt;
        &
    lt;/body&gt;
    &
    lt;/html&gt
    Which produces something very similar to this:

    <table cellpadding="0" cellspacing="0" style="margin: 0 auto; border: 1px solid yellow; width: 600px; font: 10px Verdana;"><tr><td colspan="100%" valign="top" style="border: 2px solid blue; background: #aaaadd; width: 100%; height: 40px;">Header</td></tr><tr><td valign="top" style="border: 2px solid red; background: #ddaaaa; width: 150px; height: 200px;">Menu/navigation</td><td valign="top" style="border: 2px solid green; background: #aaddaa; width: 450px;">Body</td></tr><tr><td colspan="100%" valign="top" style="border: 2px solid aqua; background: #aadddd; width: 100%; height: 40px;">Footer</td></tr></table>

    Using a table-less layout takes much of the structural information in tables and puts it in the CSS. As a result, here's the difference in the structural code for the actual HTML of your page. As you can see, the divs are a lot neater and easier to understand and code:

    PHP Code:
    <!-- note that these two bits of code accomplish exactly the same thing in this context -->
    <!-- 
    table-less layout -->
    <
    div id="container">
        <
    div id="header">Header</div>
        <
    div id="menu">Menu/navigation</div>
        <
    div id="body">Body</div>
        <
    div id="footer">Footer</div>
    </
    div>

    <!-- 
    using tables -->
    <
    table cellpadding="0" cellspacing="0" id="container">
        <
    tr>
            <
    td colspan="100%" valign="top" id="header">Header</td>
        </
    tr>
        <
    tr>
            <
    td valign="top" id="menu">Menu/navigation</td>
            <
    td valign="top" id="body">Body</td>
        </
    tr>
        <
    tr>
            <
    td colspan="100%" valign="top" id="footer">Footer</td>
        </
    tr>
    </
    table


    <a name="lol">If</a> you still absolutely must keep playing with this layout and still want to centre it, there are two things you need to do in the first &lt;table&gt; tag:
    1. Change the width attribute to something less than 100%. Whichever width looks the nicest to you.
    2. Insert a style attribute defining the margin. The tag should wind up similar to this:
    PHP Code:
    <table height="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" width="70%" style="margin: 0pt auto;"

  5. #5
    Gatekeeper of Strong Wind syun_ukiya's Avatar
    Join Date
    Jul 2001
    Location
    .A N I M E E X E
    Posts
    434

    Default

    this is what i did, centering should be okay but will it possible to extend the stripes background to the left and the right side?
    Attached Images Attached Images

  6. #6
    Gatekeeper of Strong Wind syun_ukiya's Avatar
    Join Date
    Jul 2001
    Location
    .A N I M E E X E
    Posts
    434

    Default

    i have tried the right, this should be okay but i hope i can get the background on the left im not sure how or is there a solution for it
    Attached Images Attached Images

Posting Permissions

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