+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
Like Tree5Likes

Thread: CSS Top panel

  1. #1
    techboy660181 is offline x10Hosting Member techboy660181 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    4

    Question CSS Top panel

    Hi all, I would like to create a thin navigation bar on the top of every page, using a PHP include(). However, I am not sure how to create it. Should I use a table, or...I don't know. If anyone has visited PSPicy.com, I want something exactly like that.

  2. #2
    Dead-i's Avatar
    Dead-i is offline Community Advocate Dead-i has a spectacular aura about
    Join Date
    Aug 2011
    Location
    United Kingdom
    Posts
    1,448

    Re: CSS Top panel

    Usually when I create a header template with incldue I use table, since (compared to div) it offers ALIGN, meaning I can make it center if I want. Plus, table allows you to make multiple elements alongside each other quickly and professionally (eg. a logo and then a navigation bar next to it).

    In order to make a header with include() and TABLE, you can follow these steps. On each page, enter the following code to include the header where you want the header to appear:
    Code:
    <?php
    include 'header.php';
    ?>
    Remember the webpage must have the .php extension. You could also use require() instead, which will make PHP show an error and stop the script if the file can't be found. You will also need to create header.php in the same directory with the HTML code you want. For example
    Code:
    <table align=center width=800><tr>
    <td><img src=logo.png></td>
    <td><a href=index.php>Home</a> | <a href=services.php>Services</a> | <a href=contact.php>Contact</a></td>
    </tr></table>
    I hope this helps

  3. #3
    techboy660181 is offline x10Hosting Member techboy660181 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    4

    Re: CSS Top panel

    +1 rep thanks

  4. #4
    Dead-i's Avatar
    Dead-i is offline Community Advocate Dead-i has a spectacular aura about
    Join Date
    Aug 2011
    Location
    United Kingdom
    Posts
    1,448

    Re: CSS Top panel

    Your welcome, and thanks for repping

  5. #5
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: CSS Top panel

    Um, not to be obnoxious or anything, but centering in CSS (with a block element, or any element that's set to display as block) is trivial*; you absolutely do not need to use a table unless Netscape Navigator 4 is high on your "browsers to support" list. Your navigation bar is a list of links and actions that the user is able to carry out, so a list is how it should be presented in HTML (ul or ol is up to you); you may choose to indicate its separation form the page content by making it a logical division (a div) in pre-5 (X)HTML, or as a nav element in HTML5.

    Tables are for tables. If there isn't a natural row/column relationship between the cell contents, then a table is the wrong element to use. It just makes things unnecessarily hard for people who are already having a hard enough time. Every developer should, at some point, grab an evaluation copy of Jaws to see how visually-impaired users (and machines/bots) experience their pages -- it's quite an eye-opener†.

    Your markup should be semantically meaningful -- or at least as semantically meaningful as the tags and attributes allow. Remember, HTML is a language to describe the [i]content[i] of a document, not its appearance. We kind of forgot about that back in the '90s for a while (we pretty much had to, since the major browsers were running off in different directions and there was no real standard). We're sorry we did that, and we've worked hard to create an environment where you don't have to do what we did anymore.

    * That includes centering the bar, centering the text or contained elements withing the bar, and centering the text/images within contained elements within the bar -- both horizontally and vertically.

    † In this case, there is a lot of information about the table context thrown at the user. Blind users can't see your table, so they need to be told when the row and column change (and if there's a TH that applies, what the "tag" is for that cell's data).
    misson and ka.de.xaeoc73 like this.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

  6. #6
    Dead-i's Avatar
    Dead-i is offline Community Advocate Dead-i has a spectacular aura about
    Join Date
    Aug 2011
    Location
    United Kingdom
    Posts
    1,448

    Re: CSS Top panel

    @essellar - The reason I recommended tables was because if you do text-align:center on a DIV, it will just center the text inside instead of the DIV itself. Also, tables give you the flexibility of creating multiple cells side by side.

    I understand your point though: There may be no need for a table if you only need one cell, since tables are tables
    techboy660181 likes this.

  7. #7
    techboy660181 is offline x10Hosting Member techboy660181 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    4

    Re: CSS Top panel

    Thanks for that. However, I am not using this page for handicapped people, as you have to login first and the website is only for my friends.

  8. #8
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: CSS Top panel

    Quote Originally Posted by Dead-i View Post
    @essellar - The reason I recommended tables was because if you do text-align:center on a DIV, it will just center the text inside instead of the DIV itself. Also, tables give you the flexibility of creating multiple cells side by side.

    I understand your point though: There may be no need for a table if you only need one cell, since tables are tables
    Horizontally centering a div in its containing element is easy. For any browser that's reasonably modern, it's simply a matter of using:

    Code:
    margin: <some value for vertical> auto;
    ... and the div is centered. If you need to support ancient versions of Internet Explorer (version 5.5 and below, IIRC, or maybe that includes 6, which I haven't supported for years), you can use this old trick:

    Code:
    left: 50%;
    margin-left: -<half the horizontal size>;
    Negative margins are legal. That trick, then, puts the "home box" of the div in a position where the left edge of the box is centered, then uses a negative margin to pull the left edge of the "display box" back to a centered position. Again, centering content (both the boxes and the content of the boxes) is trivial. And creating "multiple cells side by side" is also incredibly easy with non-tabular block elements. There is no excuse for using tables for something like this. None.
    Last edited by essellar; 09-04-2011 at 02:41 PM. Reason: fixed bbcode tag
    misson likes this.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

  9. #9
    Dead-i's Avatar
    Dead-i is offline Community Advocate Dead-i has a spectacular aura about
    Join Date
    Aug 2011
    Location
    United Kingdom
    Posts
    1,448

    Re: CSS Top panel

    @essellar: I didn't know about that trick; thanks! :D

  10. #10
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: CSS Top panel

    Oh, and just for the educational value, anyone who stumbles across this thread might want to take a quick boo at Mark Pilgrim's Dive Into Accessibility. None of the recommendations are all that hard to implement (it's not like trying to meet the impossible goal of a triple-A WCAG certification) and they'll pay you back several times over.

    And for anyone who's interested, I care mostly because I'm rather more severely disabled than my online persona might lead you to believe -- but before being suddenly thrust into this world, I was a "pragmatic" developer who didn't have time for all of that accessibility crap. I can't think of a single site I developed (and there were dozens of large apps on that list) in the Before Time that I would be able to use now. Are you so sure that you or your friends are immune from accident and illness?
    misson likes this.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. logging to web panel and c panel
    By duraid12145 in forum Free Hosting
    Replies: 1
    Last Post: 09-28-2010, 03:08 PM
  2. Replies: 5
    Last Post: 03-18-2010, 08:45 AM
  3. Problem accessing ACCOUNT PANEL and SUPPORT PANEL
    By marcog1956 in forum Free Hosting
    Replies: 4
    Last Post: 03-08-2010, 08:19 AM
  4. cannot loggin into account panel or c panel
    By smartflower2002 in forum Free Hosting
    Replies: 1
    Last Post: 11-19-2009, 11:43 PM
  5. Replies: 6
    Last Post: 06-24-2009, 03:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers