Forum Moderators: open

Message Too Old, No Replies

placement of nav bar in the html code

html, nav bar, css question

         

BicyclingGuitarist

12:02 am on Apr 17, 2003 (gmt 0)

10+ Year Member



On dozens of my pages, I have to scroll through several screens of code in the source to view the content. How will that affect how the search engines read the page? Will I be penalized for this, or will I see the same list from the menu bar as the description for all the pages in some search engines?

I have heard I could put the menu bar and bread crumb at the end of the source code, then position them at the top of the page using css. I tried a bit and wasn't too successful yet. Assuming I figure it out or someone tells me how, should I do that? If I do, what about the skip links at the beginning of the menu bar? Are they then unnecessary?

[edited by: BicyclingGuitarist at 12:31 am (utc) on April 17, 2003]

martinibuster

12:21 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



read the tos. you've violated two of the rules already.

[webmasterworld.com ]

BicyclingGuitarist

12:28 am on Apr 17, 2003 (gmt 0)

10+ Year Member



I am sorry.

pendanticist

12:30 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cool.

By the way, Welcome to WebmasterWorld BicyclingGuitarist [webmasterworld.com]

Pendanticist.

[edited by: pendanticist at 12:34 am (utc) on April 17, 2003]

martinibuster

12:31 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Please use the little link to the left of your post and edit the offending post so that the url and the request for a site review are eliminated, and I'm sure that lots of folks around here will start crawling out of the woodwork.

:) Y

martinibuster

12:34 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Is this stuff JavaScript? If this is JS then you can just link it externally.

It's good to have your content close to the top; linking out to the css and the js is a very good strategy.

If possible, you may want to forego the JS and go for a purely css rollover (of course, it's not an option for everybody, but I try for that as much as I can).

grahamstewart

12:38 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check out this thread in the CSS forum.
[webmasterworld.com...]

You may want to look for others regarding Search Engine Optimisation (SEO) and CSS positioning (CSS-P).

Basically you place your content first in the html and then use css to put the links above it.

I usually still include a 'skip to content' (as some visual browsers apply the css styles and then read it), but I also usually include a 'skip to links' at the start of the content for those that don't.

BicyclingGuitarist

12:45 am on Apr 17, 2003 (gmt 0)

10+ Year Member



No, my nav bar is not javascript. It is a list of links using css. The bread crumb is nested lists using css (from alistapart). The menu bar and bread crumb html code all come before the <h1> of the content. I *think* I can put the navigation code at the end of the source code and place it on the page using css, but when I tried that the navigation bars lay on top of the <h1> and other content.

pageoneresults

12:52 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



But when I tried that the navigation bars lay on top of the <h1> and other content.

In this type of scenario, using css to position html, all of your content needs to be positioned. I usually have a <div class="main"> that is absolutely positioned. That <div> comes right after the body tag and contains the main content. Then my graphic navigation and text navigation are in absolutely positioned divs at top and left.

I utilize includes and have a footer that is included at the bottom of all of my <div class="main>. My html might look like this...

<body>
<div class="main>
<h1>Welcome to WebmasterWorld</h1>
<p>Please refer to the TOS for more information.</p>
<include for footer>
<include for left nav>
<include for header>
</div>
</body>

It gets a little tricky with the includes but once you have it figured out, tis a breeze maintaining. Simplicity is the key. ;)

BicyclingGuitarist

1:04 am on Apr 17, 2003 (gmt 0)

10+ Year Member



I have never used "includes". The menu bar is the same for all pages, so that would be a likely candidate for this technique. The bread crumbs of course change with every page. I can see making a content div and a navigation div. I want the content to be first in the code, but I want the navigation bars to be at the top of the page as rendered in css-capable visual browsers.

If the list of links is at the end of the code, I like the idea of using "skip to content" in the links code and "skip to links" in the content code.

pageoneresults

1:24 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Here's an example using an external css file.

In your external css...

div.main{position:absolute;top:200px;left:140px;width:600px;}
div.navleft{position:absolute;left:10px;top:240px;width:130px;}

<body>
<div class="main">Content here.</div>
<!-- Include -->
<div class="navleft">Navigation here.</div>
<!-- Include -->
<div class="top">Top navigation graphics here.</div>
</body>

Once you absolutely position something using css, you can position your html code wherever you wish. You take the <div></div> and place it where you want it. Since the css is telling the browser where to position those <div>s, the order in which they appear in the html code isn't a factor. Although, you do want to make sure that you order your <div>s properly. Content <div>s first, then textual navigation <div>s and then graphic navigation <div>s.

You will need to keep a calculator handy and make sure that you utilize your space correctly. I like everything pixel perfect, others may not be so meticulous.

BicyclingGuitarist

1:57 am on Apr 17, 2003 (gmt 0)

10+ Year Member



I can see the nav div being placed at the top of the page with absolute positioning (my nav bars are horizontal btw). However, if I use absolute positioning to place the content div next, then I have to specify a distance from the top of the page where to start. That will vary tremendously based on how much the nav bars wrap at different sizes of viewing windows. Is there a way to make the content div start after the nav bar if the distance from the top of the page will be varying? My pages are fluid design, content expanding or contracting as needed.

[edited by: BicyclingGuitarist at 2:12 am (utc) on April 17, 2003]

pageoneresults

2:09 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There is a way and I'm hoping one of our resident css gurus will lead the way for you. I work strictly with fixed positions and therefore have not had the experience with working in a fluid environment.

grahamstewart

3:02 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Speaking as one of the "resident css gurus" ;), I don't think there is a good solution to this. It is simply one of the limitations of this technique.

When you absolutely position elements you remove them from the normal flow, so if you want your content below your div then you will probably have to absolutely position it too.

To get around the problem of the navbar growing over the content I use two techniques.

Firstly I make sure that the navbar fits okay, without wrapping, in the common resolutions (640x480, 800x600, 1024x768). Its always wise to leave a little bit of extra space in case someone increases the default font size.

Secondly I set the CSS property

overflow:auto
on navbar div. This means that if someone views it in a smaller resolution than I was expecting, or if they increase the default font size by a large amount, then the navbar will get a vertical scroll bar to deal with the extra height.

Not exactly elegant, but better than having it overwrite your content.

The other alternative would be to use a bit of javascript to reposition the content - but I hate Javascript so i try and stay away from that.

martinibuster

3:17 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



in the common resolutions (640x480, 800x600, 1024x768).

640x480 is not a common resolution. It is very uncommon.

BicyclingGuitarist

3:27 am on Apr 17, 2003 (gmt 0)

10+ Year Member



I wouldn't want the links nor content to be inaccessible to those using a pda or webtv to surf my site. For my preferred visual layout of the home page, I had to fiddle with the width of the divs a bit to get it to not break at 800x600, but it can go a little smaller than that now (but not all the way to 640x480) before the photo div drops down.
The problem this thread is addressing is for all the other pages of my site, most of which can squish very narrow with all the content and photos visible. It sounds like absolute positioning may not be the ticket after all. How badly will I be spanked by search engines for having two bunches of navigation code before my <h1> and other content?

grahamstewart

3:29 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



640x480 is not a common resolution. It is very uncommon.

Around 2% according to BrowserNews [upsdell.com]

So slightly more common than NN4 and people still try and design for that. :)

640x480 or lower may get more common in the future as more people start using handheld browsers or web-capable TVs.

martinibuster

3:53 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



in the common resolutions (640x480, 800x600, 1024x768).

Around 2% according to...

2% is not common, and it is important that this be made clear.

It's important because it's unfair to make someone spin their wheels over a standard that has already lost it's relevance.

If we were to accept 2% as the definition of common, then are you also asserting that NN 4x users are common, and that a web site should be NN 4x compatible?

grahamstewart

4:40 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



are you also asserting that NN 4x users are common, and that a web site should be NN 4x compatible?

Personally I don't specifically alter my code to be compatible with NN4, but I know from the CSS forum that plenty of other people do.

As for screen size, yes 640x480 is uncommon. However, I wouldn't write a site that requires the user to have a large screen (i.e. one that has a fixed 600 pixel width for instance). That's just excluding some of your audience because of bad design. (as opposed to excluding them because their browser is too damn buggy to write code for).

If the site looks better on a large screen, then fine, but a decent fluid layout should be able to cope with 640x480 in a reasonable manner.

As I said before, more people are starting to use small resolution mobile devices so we might reasonably expect to see an increase in the number of visitors with small screens.

BicyclingGuitarist

5:16 pm on Apr 17, 2003 (gmt 0)

10+ Year Member



Most of my site has divs that wrap in such a way that the width of the widest image is the limiting factor to how narrow the viewing window can be for one to still see all the content.

How about putting the menu and nav bars in a container div that is absolutely positioned at the very top of the page, then the content in another container div that is absolutely positioned some percentage from the top of the page? I wouldn't mind a little white space between the navigation links and the content.

What percentage number from the top should I plug in to allow for wrapping? Should I test for viewing windows as small as 200 wide, or 320, for the navigation links to not cover the content when they wrap? I don't want so much white space at common browser resolutions that the content doesn't start until halfway down the screen...

Thanks.

grahamstewart

10:25 pm on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nah, for resolutions as small as that I'd allow the navigation to be scrollable (by setting overflow:auto on the navigation div, as mentioned above).

BicyclingGuitarist

2:20 am on Apr 18, 2003 (gmt 0)

10+ Year Member



I've placed a navbar div at the end of the html code, but used css styles to place it at the top of the page. I used the "skip to content" idea proposed here instead of the "skip links" I had before. It makes more sense when one encounters the hyperlink at the bottom of the page in text browsers or browsers with styles turned off.

I also used absolute positioning for a content div, placed 17.5% from the top of the page to allow room for my menu bar and bread crumb bar to wrap in smaller windows. I think this will work. I tested it with some siteviewer tools to see how it degrades. It is degrading nicely. Hmmmm...that doesn't sound right for some reason.

BicyclingGuitarist

5:14 am on Apr 21, 2003 (gmt 0)

10+ Year Member



At 640x480 I have text overlap from the two nav and content divs, especially at larger text sizes. I have already increased the content div's distance from the top to 20%, but there are obvious design limits to that approach. Do I need to change the "overflow: auto" attribute for the navbar div to something else, put it in the content div, do something else?