Please Review Code

Hi, I have put up my first ever home page, I have spent a long time trying to learn what I can to get to this point and I have found it both very difficult but also immensely rewarding. It is hard though without having a mentor to turn to ask questions.

My home page (www.anna-b.co.uk) looks pretty much how I want it to on a couple of different laptops and my computer at work in both I.E.8 and FF. But everything I have done has been pulled from different bits of information from the internet and I know I have butchered some things to get it to work.

Anyway the reason for my post is that I want to learn how to do all of this the right way and I am hoping that you kind guys and gals will assist by reviewing my code. Please tell me what aspects of my code should be changed, why and how.

I am not looking for a review of the aesthetics just yet though hence the reason I have added it to this section of the forum

Thanks

Hi Deathshadow

Thanks for the help I will have a look at this in more detail over the next day or so.

Yes this is my first ever site and you have no idea how helpful that comment is, one of the most difficult things is spending all this time without having any clue as to whether you are heading in the right direction, so thanks :).

I have had to learn every aspect including just producing simple graphics from scratch and it does feel like I have been working on just this one page forever. I have basically been making it up as I go along but I really want to know how to do it the right way and this thread was put up purely to try to get guidance on that.

Anyway just wanted to pop in and say thanks for taking the time to help, I will be back when I have worked through it. I hope you don’t mind if I come back with more questions.

Ok, first up if this is your first site, you’ve done quite well and show a lot of promise.

Immediately on loading the page though the layout is broken here in both opera and IE because you used dynamic font heights on top of fixed height backgrounds. Fixing the height of ANYTHING containing text is going to fail, which is why the ‘flexible and friendly’ LI is blowing over the ‘read on’ link and has it’s last word below the border on large font/120 dpi systems like mine.

The POINT of using dynamic fonts (%/em) is that they will automatically grow larger for users who have a different ‘system metric’ – aka dpi setting, aka in legacy windows “large fonts/small fonts” and in modern windows Small/96dpi and Medium/120dpi. (and that’s before we even talk win7’s Large/144dpi or max/192dpi).

Also there’s a thing called ‘min-width’ that I would most certainly apply to this layout since the header breaks horribly if the page is allowed to go narrower than a certain width… that or I’d reconsider how the header is built/laid out and restrict it inside the fixed width… Though on that note I’d be throwing the whole layout away as I don’t believe in fixed width layouts - especially one wider than 1024. I know you didn’t want comments on design, but changes to the code for accessibility and sensibility compromise many elements of the design – like the fixed height elements… like the 300px tall one word links that chew endless amounts of display space for nothing… etc, etc… Like the menu that by definition makes it impossible to make the page even 1024 friendly.

Peeking under the hood people were quite correct in this thread on cleaning up the header (apologies if I repeat some of what’s already been said) – and frankly some formatting wouldn’t hurt. I don’t know if you are intentionally white-space stripping before deployment (a total waste of time IMHO) or if you are coding that way, but really until you have it hammered in, get some formatting in there just to make it clearer what’s going on.

Getting past the header one of the first things to grab my attention is the nonsensical heading orders. “Live in Sheffield” is not the start of a section of content, nor is it the parent heading for the h3’s that follow. there is NO reason that should be a h2, and all of your h3’s should be h2.

Think of heading tags as fanning out like a tree. H1 is the root/trunk (in the end there can be only one), h2’s are branches off that root, h3’s are branches off those branches, etc, etc. A ‘heading’ is the start of a section. Lower order headings (aka higher numbers) are by definition the start of subsections of the header preceeding it.

That said you seem to have a goodly number of div for no reason here… though I’d have to rewrite it to say for certain. Most of the time I just say that the moment I see a #header div as I’ve rarely if ever seen that one actually neccessary in a layout. (I’d probably end up with the same number just in different places since I’d open up the design to fully fluid)

The image replacement technique used on the menu does not gracefully degrade images off – defeating the POINT of using image replacement. This is probably why SP pointed you at one of my menus in the first place (I kinda skimmed existing posts).

The use of span and a class to apply color doesn’t say WHY you are a applying color. I would make those either STRONG or B tags to imply that those are the ‘important’ part of the text.

So if I had written that the starting point for my markup would probably be this:


<!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"
	lang="en"
	xml:lang="en"
><head>

<meta
	http-equiv="Content-Type"
	content="text/html; charset=iso-8859-1"
/>

<meta
	http-equiv="Content-Language"
	content="en"
/>

<link
	type="text/css"
	rel="stylesheet"
	href="screen.css"
	media="screen,projection,tv"
/>

<title>
	Anna B - Mobile Hairdresser
</title>

</head><body>

<div id="pageWrapper">

	<h1>
		<a href="index.html">
			Anna B
			<small><span> - </span>Mobile Hairdresser</small>
		</a>
	</h1>
	
	<a href="contact.html" class="pinkcard">
		Live in Sheffield S35/S6?<br />
		Call 0871 3021046 to book!
		<span></span>
	</a>

	<ul id="mainMenu">
		<li><a href="index.html" class="current home">Home<span></span></a></li>
		<li><a href="about me.html" class="about">About Me<span></span></a></li>
		<li><a href="price.html" class="price">Price<span></span></a></li>
		<li><a href="contact.html" class="contact" >Contact Me<span></span></a></li>
		<li><a href="testimonials.html" class="testimonials">Testimonials<span></span></a></li>
		<li><a href="gallery.html" class="gallery">Gallery<span></span></a></li>
		<li><a href="services.html" class="services">Services<span></span></a></li>
		<li><a href="articles.html" class="articles">Articles/Products<span></span></a></li>
	</ul>

	<div class="wideContentBox">

		<a href="gallery.html" title="View Gallery" class="leadingPlate">
			<img src="images/pinkhair2.gif" alt="Pink Hair"/>
		</a>

		<h2>
			How can I get <strong>stylish</strong> hair at a <strong>reasonable</strong> price without leaving my home?  With <strong>Anna B</strong> you get this and more... 
		</h2>
		<ul>
			<li>
				<strong>18 years experience</strong> with 6 years salon experience including management.
			</li><li>
				12 years mobile hairdressing experience - Anna B established <strong>1998</strong>.
			</li><li>
				Flexible and <strong>friendly</strong> approach with a large number of repeat customers.
			</li>
		</ul>

		<a href="aboutMe.html" class="readMore">Read On</a>

	<!-- .wideContentBox --></div>

	<ul class="smallContentBoxes">
		<li class="price"><a href="price.html">Price</a></li>
		<li class="testimonials even"><a href="testimonials.html">Testimonials</a></li>
		<li class="services"><a href="services.html">Services</a></li>
		<li class="areaCovered">
			<div id="mapSearch">
    		<span>Hair we go....</span>
    		<noscript><p>Map requires javascript to function</p></noscript>
    	<!-- #mapSearch --></div>
			<a href="contact.html">Area<br />Covered</a>
		</li>
	</ul>
	
<!-- #pageWrapper --></div>

<div id="footer">
	<ul>
		<li><a href="index.html" >Home</a></li>
		<li><a href="about me.html" >About Me</a></li>
		<li><a href="price.html" >Price</a></li>
		<li><a href="contact.html" >Contact Me</a></li>
		<li><a href="site.html" >Site Map</a></li>
		<li><a href="other.html" >Other Information</a></li>
	</ul>
<!-- #footer --></div>


<!-- google maps ajax search -->
  <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAKsuI1xhOqdAxPh42QeV02BTCQTycGHxKQAwquO-6wcuhUtdlaxSSMrRw4q7Ofj7LxJg3qLxEf3UeFw"
  	type="text/javascript"></script>
  <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-msw&key=ABQIAAAAKsuI1xhOqdAxPh42QeV02BTCQTycGHxKQAwquO-6wcuhUtdlaxSSMrRw4q7Ofj7LxJg3qLxEf3UeFw"
    type="text/javascript"></script>
  <style type="text/css">
    @import url("http://www.google.com/uds/css/gsearch.css");
  </style>

  <!-- Map Search Control and Stylesheet -->
  <script type="text/javascript">
    window._uds_msw_donotrepair = true;
  </script>
  <script src="http://www.google.com/uds/solutions/mapsearch/gsmapsearch.js?mode=new"
    type="text/javascript"></script>
  <style type="text/css">
    @import url("http://www.google.com/uds/solutions/mapsearch/gsmapsearch.css");
  </style>

  <style type="text/css">
    .gsmsc-mapDiv {
      height : 225px;
    }

    .gsmsc-idleMapDiv {
      height : 225px;
    }

    #mapsearch {
      width : 260px;
      margin: 0px;
      padding: 0 0 0 5px;
	
		
    }
  </style>
  <script type="text/javascript">
    function LoadMapSearchControl() {

      var options = {
            zoomControl : GSmapSearchControl.ZOOM_CONTROL_ENABLE_ALL,
            title : "Googleplex",
            url : "http://www.anna-b.co.uk",
            idleMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM-3,
            activeMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM-3
            }

      new GSmapSearchControl(
            document.getElementById("mapsearch"),
            "S6 6LJ",
            options
            );

    }
    // arrange for this function to be called during body.onload
    // event processing
    GSearch.setOnLoadCallback(LoadMapSearchControl);
  </script>
  
<!-- ++End Map Search Control Wizard Generated Code++ -->

</body></html>

Not THAT different, but a few changes/re-arrangements and renames.

It probably would grow with a number of DIV sandbags in an attempt to retain your styling while opening it up to a WORKING semi-fluid layout and dynamic heights on that primary box with text in it.

For reference, here’s a screencap of what I mean by that fixed height element breaking.

Hi Stomme

Again a million thanks for your help. I have been through most of it but haven’t put up the updated version of the site yet, I will do that later today when I get home from work (about 6 hours from now)

I’ll Keep in mind trying to differentiate between content and decoration for the alt text, your posts have helped me think about this quite a bit.

After looking at everything you said and using the background suggestion below I have it centred and feel comfortable with the boxes below the header. But I do not fully understand how I have achieved the header. The total size of the tabs is 880px but I have to set the header menu to width of 920px which seems to have centred it. Also like the screenshot you have shown I haven’t been able to put a background color to show the 920px box. Not sure what is going on any suggestions.

Edit please ignore this bit I have now sorted it see below(I left this in to show what I did)

I am not really sure what this all means

Absolutely brilliant tip that, I wasn’t sure what you meant until I tried it and it made it all clear, I do often think I am unsure how it all hangs together and this really makes it clear. I use Firebug but this really helped me see the overall layout, thanks

Not really following this, is it linked to the menu problem I am originally couldn’t fix above and the reason why I couldn’t work out how to add a background color

I know something about this as I was using text-shadow for a bit but decided against it because of the lack of IE support.

This is definitely something I need to look into further , at the moment I am only checking on FF and IE8 and I know I really need to do it now rather than later.

I have read through that thread some great info there, that is certainly going on my list of bookmarks, in fact it has even helped me get a little nearer to understanding the menu problem mentioned above. I added a suggestion to the css made by deathshadow which was set all margin and padding to 0 it then moved the menu and when I now add 880px hey presto it goes back central. It did move some of the text further down but I went through and sorted this (some of them had a minus px setting for the top before which I knew wasn’t right but didn’t know why) I guess there must have been some default padding or margin taking place that I didn’t know about
He has done a great job with that site that he has replicated I viewed it with images off and can see how the image replacement works. I have managed to do the technique with my logo and the information card on the right but it has totally beaten me in respect of my menu

Edit

I didn’t read the other link and note that you mean set it up just like that site that has been worked on i.e with just one image as the header. Right I will have a go at that (probably take me the rest of the week if not longer) and I’ll report back when done. That will give you time to look through the other parts of this and respond with any thoughts you have

That is exactly what the problem is, it now works thanks for that

Do you mean I should remove the absolute positioning, when I do the text falls below the box, how should I position it?

I am always looking to build my bookmarks of useful websites, forums and tools, are you able to share the name of the forum (is it digital point as I have now added that)

Good idea that is just something that hasn’t sunk in so I need to try and remember it, in fact found this link is useful which seems to cover it dustindiaz.com/css-shorthand/

Sorry about the twigged thing it may be a UK thing or even a regional thing, it means understanding something after initial difficulty. i.e The penny has dropped (may not be a great example), now I get it, I have now caught on.

Wow don’t know how you can say that you are clearly a very clever person, if that is the case then if I was a marker I would have run out if ink :smiley:

I have done some work on this and hopefully it now works I have added a bigger font stack but if you can have another look and let me know if there are still problems.

I know there are figures to show the percentage of users who use IE or FF and the different versions etc, are there any stats regarding number of users who have javascript turned off or other strange browsers settings as it would be interesting to know how a big an issue it is when considering how to design. Out of interest why do you have javascript turned off, it seems a bit alien to me as I want to see what the person who has designed a site wants me to see.

I think I may just have an image as the search function is not really needed and is obviously causing problems. This is something I will look into further this week

Are there any tutorials that can help with this. I have put the max width on the .wrapper and the main box which now lets it decrease in size but I am unsure how to position the text, if I leave it absolute it goes over the image and if I change it to floating right or left (not sure if this was the right way to approach it) but when the screen decreases the text disappears.

Finally I just wanted to say that I started my learning by reading books and tutorials etc and whilst I am really enjoying producing something creative I am finding it really tough learning everything, there are a lot of new disciplines to get your head around. It is even more difficult to learn when you have no one to turn to for help so I really truly appreciate your advice. I do find it hard that when I study a topic from say a book or a tutorial I feel as though I don’t learn the details in a real life context, yet when I am building my site and obtain some info from the web to overcome a problem I don’t feel as though I am learning and understanding the fundamentals for next time. I am also struggling to understand fully how it all hangs together, or maybe it is just a confidence thing.

Anyway the reason for the waffle* is that I have an idea for a site that I want to pursue after this. I am thinking about taking the CSS course advertised on here, do you think i would be better putting some time into studying maybe this and a Photoshop book before I start another site or would I be better to plough straight into the site carrying on trying to learn elements as I build it? Sorry for the rambling*.

*Saying too much without getting to the point

:slight_smile:

It’s been 4 long years and I’m still learning HTML and CSS.

I have made some further changes, before I carry on could somebody have a look at the code now and just check whether there are any really bad issues or problems that need rectifying before I continue. Thanks

Finally I have finished making the changes and the site is now updated www.anna-b.co.uk, every slight change seems to take me forever.

I have changed the doctype and rearranged the HTML element information as suggested, I also found the Unicode article very interesting, I have made some changes to the alt text on the site but assume this whole aspect is subjective as the tests mentioned in the survey seemed to be contradicted . Also on some aspects the survey was quite close in its results. Anyway have a look at the changes and let me know if there is anything that is obviously wrong. Also I have put a number of images as background images (as per your suggestion), how do I add alt text to them.

Yes this is a regional thing in the UK S35 and S6 are postal codes which are similar to the US based Zip Codes.

when I change the header menu as suggested it seems to work but there is a slight change to the positioning of the navigation bar in that it moves left on all pages by about 10% so it no longer looks central. I’m not sure why it was central and whether that was just on the screens I am using. How can I make it look central again the right way. Also how can I make the rest of the boxes further down always be central, I have tried to do it but it no longer looks central not sure if that is because of these changes or whether it was never really central to start with

Another great article about Image replacement, and an off topic question but will CSS3 fix problems like this?
I have tried to do the image replacement technique but just can’t seem to make it work, do you know if there is a more detailed tutorial anywhere.

Not sure how I came across building in the hover state but never saw anything about : focus I have now added it so thanks for that

Regarding the Div List I have moved it to the ul but when I do that it is not working. The list is no longer then being styled which I assume is the way I have done it (is this the same problem for the menu div mentioned earlier?) The HTML is now


<ul class="list">
<li><span class="pinktext2" >18 </span>years experience with 6 years salon experience including salon management.</li>
<li>12 years mobile hairdressing experience – Anna B established <span class="pinktext2">1998</span>.</li>
<li>Flexible and <span class="pinktext2" >friendly</span> approach with a large number of repeat customers.</li>
</ul>

and the css is


.list u  l{margin: 0 0 0 0; 	padding: 0 0 0 0; top: 130px; right: 10px; width: 600px;  	font-family: trebuchet ms", helvetica;  font-size: 100%; }

Please let me know where I am going wrong

Regarding the price bit being unfinished you are right all the boxed areas are going to link to other pages I just haven’t done them yet, the price page will go to a price list

I seem to have got all the floating stuff working and have undertook your suggestions, I can see how the changes have made it easier for me to manage and change things. Does the reduction in code make a difference or is this more to do with trying to get best practice for when I build gigantic websites because then it will make a difference. Also I think it has twigged that I need to look through my code to see what is the same throughout and then just have it linked to one class to again to reduce code bloat, is that right?
The float problem has not appeared that you were discussing with Paul O’B but I haven’t tried it in IE6 or 7 and the float boxes are the same size. Do I need to do anything regarding this?

The area covered problem was because your browser wasn’t working with the leaguegothic font, this is a @fontface set up so not sure what caused the problem, have you any idea? Anyway I have changed the layout a bit and put an alternative font that should also work when the @fontface doesn’t let me know if it is ok. The Here we go should only show for a few seconds whilst the google map is loading, does that mean the google map didn’t appear for you?
The google map was just something I stumbled upon when trying to find how I would add the map to show a boundary, do you know what the best way is to add it?

I am not quite sure how to implement the maximum width idea any suggestions or do you know any good tutorials
Overall it has been a lot of work but has really tested me (which is good) particular changing the smaller boxes, if you get chance could you have another look at the site and let me know if I missed anything.

Thanks again

Thanks for that :slight_smile:

OK, that link’s fixed now. (Thanks to Robert for pointing out the mistake.)

Hi Your link isn’t working :slight_smile:

If we keep comments relevant to correcting mistakes in your coding then I’ll let this thread stand rather than moving it to a review forum.

My ears were burning… and sure enough here we are.

SP is correct in that people don’t really understand what :active is, and it doesn’t help some people using the ‘class’ active forgetting one of the basic rules of making code easier to understand – DON’T use reserved words for variables names; or in this case don’t use the same name as a tag or psuedoclass/psuedostate on a class/id.

:active is SUPPOSED to indictate when the user is holding down the mouse button on the element – but the actual implementation (and rules in the specification) is sufficiently vague that some browsers like IE use it to indicate when you’ve keyboard navigated to it, some browsers like FF do not undo the state when you release the mouse button, etc, etc… The big thing that confuses people on this is it means the current page - if you put it on a link, and they click, that takes you to a NEW page so it’s not going to be remembered on the new page.

:focus is similar in function, and is the psuedo that’s supposed to be used for keyboard navigation to indictate you have selected an element, but NOT that you’ve activated it.

As a rule of thumb, I treat :active and :focus just like I would :hover. If I declare one of them, I declare all three.

For the ‘current’ page as SP just explained, you have to move the class around on every page. This is best/most easily done IMHO by incorporating a bit of php into your pages; something that these days you might as well do anyways just so all those like elements (like the header and footer) can be a single file so if you want to change the menu, you only have to edit one file instead of twenty.

Now, looking at your page. One moment, I’m gonna write up a few things that have been ‘missed’ so far on issues.

Hm, I’m taking off in an hour or so for a week away (fall holiday over here) so I’m trying to think of links… though in general instead of doing

#somelink:hover span {
background-position: something new;
}

you’d put a class on it instead:
#somelink.current span {
background-positoin: something new;
}

Definitely there are a lot of questions around here on the forums where people were confusing :active pseudo state with the current page link being highlighted, but almost all of those have someone explaining how to write code for it. Yours would just be moving a background image instead.

a list apart may have an article on a simple gilder-levin menu with hover and/or current states.

Finally I have had time to work through your post (life keeps getting in the way)

How would I do this ( I really am new to all of this) I want each box to be the same size and grow downwards if required based on peoples browser setting. If I change all the heights to 100% then the images cut off as the box is no longer big enough.

Edit I have tried to work it out for myself and added

 min-height: 284px, max-height: 100%;

which seems to work, have I done it the right way? However this doesn’t work with the main box and I can’t figure out why, any thoughts?

How would I change it to this sort of layout, is there an easy fix or is it more complicated. Would you be able to provide any guidance or is there a tutorial that could explain it.

Sorry I am bit confused about this bit, not sure what you mean. The tall words are purely a part of how I saw the site from a design/aesthetic point of view (with absolutely no design background or any previous creative skills this is a big hurdle that I face). Are you saying it looks naff (sorry just realised that may just be a local dialect word it means rubbish/poor/crap) or is there something fundamentally wrong with the way it is coded?

How would I resolve this problem?

Regarding the white space stripping I am not doing it on purpose as I don’t actually know what it means. What is it and how can I stop it? Also what impact does it have?

That is one thing I would like to know how to do, but as yet I haven’t come across anything which explains how to correctly format my code, so I have pretty much made it up as I go along. Do you know any links that gives an explanation of how to effectively format my code?

I have now changed this, thanks for the advice

Yeah I have been through once to try to improve it but I don’t really know how to reduce the number of divs.

This is something I have been trying to do and will be working on it for the rest of this week, if you have any further links regarding reading material to help me work out how to achieve it I would appreciate it. I am still not 100% sure what you meant with the earlier posts so I am going to reread all the posts and the links to try and establish how I can change my menu

I have now changed this, is this related to screen readers? Does having the text as a different colour/font size not denote that the word is important?

Thanks for that I have gone through some changes where I can, but without knowing how to add the supporting css to make the site fluid I can’t change all of it. Thanks ever so much for your taking some time out to write it up I do appreciate it.

Thanks for that I would like to make it fluid if possible but if I am not able to do so do you know why the first line of text has dropped down so far when it shouldn’t have?
I will update my site tonight as I don’t have access to make changes at work. Thanks for all you help.

Also I have no design background and so using things like photoshop has taken me ages to get my head around just producing simple things such as the multi coloured border at the top of the page took forever,

I schooled to be a radiographer and worked that way for some years. The web thing was by accident; the only “design” bit I can do is draw with pen on paper.

Hi,
sorry I’ve been the last few days away drinking too much beer at the Fronteers Front-End Conference which was awesome even if it did involve Paul Irish showing us sharks with lasers coming out of there eyes for some reason…

Anyway:

I have made some changes to the alt text on the site but assume this whole aspect is subjective as the tests mentioned in the survey seemed to be contradicted . Also on some aspects the survey was quite close in its results.

Yes, because people are all different, but one thing to remember with that particular question is, that was also a clickable logo (so some people preferred “home page” was mentioned somewhere as link destination text). I don’t remember if your logo was clickable before (I thought it wasn’t) but now that it is, adding “home page” or “main page” or something to the alt text isn’t a bad idea, esp now that it’s clickable to home while underneath is a link in the navigation to Home as well.

The other one though is perfect: the purpose of the image is solely to convey that important information and I can get it from the alt text without strange text about boxes it’s in or anything.

Also I have put a number of images as background images (as per your suggestion), how do I add alt text to them.

You don’t. The purpose of putting decoration in the background is so those images can’t possibly be confused as “content”. This is why a webmaster has to think quite a bit to determine if they think their images are content or decoration. The purpose of alt text is to make sure whatever content-images are saying is not lost when the image either doesn’t load or isn’t viewable by the user (which may be a person or may be a robot/script/machine). If you believe the content of the site really is “blue-skinned woman looking jawsome” then you don’t have her as a background image… to me, she was decoration. But it is your site and even if you are learning, ultimately you are the author of that page.

Oh, there’s one “exception” to the “background images don’t have alternative text”… and that’s when you’re using something like Gilder-Levin… there, the images “have text” (they are covering real text).

when I change the header menu as suggested it seems to work but there is a slight change to the positioning of the navigation bar in that it moves left on all pages by about 10% so it no longer looks central. I’m not sure why it was central and whether that was just on the screens I am using. How can I make it look central again the right way.

Well it’s not the clearing, but your header is 100% wide (fine) and inside your ul is like a thousand pixels wide and centered with auto-margins (also fine) but inside the li’s are floated; this also isn’t a “problem” but because the total widths of all those li’s together is less that 1000px, and they try to align left because they are floats, they all cling to the left. So the easiest way to solve this is to measure the total width of all the li’s together and set the width of your ul to that.
http://stommepoes.nl/anna-menu.png
Not something I’d normally do to a menu (set a width in px) but because you’re using images, your text in those will not grow so no actual need to expand.
Wee!
http://stommepoes.nl/anna-top.png
(remember that that screenshot isn’t affecting the blind with AT or the googles, just sighted users with CSS on)

Also how can I make the rest of the boxes further down always be central, I have tried to do it but it no longer looks central not sure if that is because of these changes or whether it was never really central to start with

You see what I did above with your menu. While I’m at the point where a lot of the time I can “see” what a page is doing by code alone, I still use this technique to see boxes; especially when I’m dealing with floats n stuff.

If you add a background colour to your wrapper, you’ll see it’s got a set width and centered with auto-margins… the stuff inside has set widths but are not auto-margined. They’re sitting to the left a bit.

Sometimes you’ll add a background colour and won’t see it (like your menu ul). This is because of floats not automatically getting contained by static containers; while a lot of the time they don’t have to contain their floats, but I’ll usually throw overflow: hidden on them to make containers enclose floats just so I can see what’s going on (sometimes overflow will cut off stuff you have spilling out of the container but for testing it’s pretty much always ok because you’re just trying to see box dimensions).

Another great article about Image replacement, and an off topic question but will CSS3 fix problems like this?

Hm, well looking at YOUR menu, most of the stuff you have on your text, yes, can all be done with CSS3. But right now there’s not enough browser implementation, and while I know most of that stuff (the rounded edges, the slight text-shadow, the colours edging the letters (font-stroke) etc) are supported by many of the newest browsers, I just was reminded yesterday at the conference that IE9 so far still has no plans for text-shadow. Currently only webkit (Safari and Chrome) support the stroke lines.

Also anyone who for whatever reason doesn’t regularly update their browser of choice isn’t going to have this CSS3 effects available (like older Operas, Firefoxes or whatever). K-Meleon is a version of Firefox that’s leaner because it’s just for Windows (doesn’t have all that other code to be cross-platform compliant) which gets updated regularly but still uses the same Gecko engine Firefox2 used (so, has most of the bugs of that engine).
In fact that’s why I have it on a copy of Windows here: it’s way easier to have a whole separate browser than to try to use profiles to keep an old version of Firefox on my machine (Opera was easy but Firefox really wanted to override my other versions).
As a developer you’ll want as many browsers on as many platforms as you can reasonably keep around for testing… this may include mobiles and PDAs, screen readers, and either extra machines or virtual boxes with other Operating Systems on it. For when it’s just not possible, something like browsershots.org can help fill the gaps (but developing with it is impossible: I wait sometimes an hour for a screenshot, so no way could I debug something with it).

I have tried to do the image replacement technique but just can’t seem to make it work, do you know if there is a more detailed tutorial anywhere.

I don’t know of one personally, but I’ll see if I have the thread still bookmarked where deathshadow did it for pixelcommander and explained it line-by-line. It is indeed tricky and when I first started, I actually copied Deathshadow’s code and changed dimensions and text to fit my own menus… now I can just write them myself.

Oh awesome, just by remembering pixelcommander’s name, I could find it:
http://forums.digitalpoint.com/showthread.php?t=427632&page=2
That’s page 2 but read that whole thread: Dan Schulz and deathshadow give out some really excellent advice there… those two guys are probably the reason I didn’t start building web sites in tables (seeings how if I had just started viewing>source of pages and tried to copy what I saw, I’d be learning really nasty habits). RIP Dan.
Anyway, the important part is seeing the sprite:
http://battletech.hopto.org/for_others/pixelcommander/images/navigation.jpg
So, a single image (a single call to the server) but each anchor (I prefer using the anchors and not the li’s because it prevents some weird IE bugs that sometimes appear) has their span hold different coordinates of the same image.
So you’d
#menu li {
display: inline;
}
to keep IE6 and 7 happy (7 likes to staircase undeclared li’s for some reason)
and
#menu a {
float: left;
etc.
}
so the anchors would have position: relative and their span children would have position: absolute to cover the anchors’ text.

If after reading that digitalpoint thread and Deathshadow’s code and playing with it that way still just makes you lose hair, then ask and if I have time I’ll do a quick one myself. They do get easier as you do more of them, but even so I often still get hit with my first link not showing the image (because I can’t remember where to make the px number negative etc). So whenever I’m not seeing my image I set the coords to 0 0 so I at least know I’ll get the first part of the image and can use small increments from there to see where I’m going.

Not sure how I came across building in the hover state but never saw anything about : focus

I would imagine because many many sites don’t deal with :focus either. Many developers still think in terms of “mice” and “desktops” and “sighted users”. They need to remember “keyboard”, “mobiles”, “touch” and some day we’re all going to be sad sad losers with internet-enabled refrigerators letting us know we’re low on milk : (


@media kitchenAppliance { ...

Regarding the Div List I have moved it to the ul but when I do that it is not working. The list is no longer then being styled which I assume is the way I have done it (is this the same problem for the menu div mentioned earlier?)


[b].list ul[/b]{
position: absolute;
	margin: 0 0 0 0;
	padding: 0 0 0 0;
	top: 130px;
	right: 10px;
	width: 600px;
  	font-family: "trebuchet ms", helvetica;
	font-size: 100%;
	
				}

Is it because your CSS still had .list ul instead of .list? I dunno. I just see the div called .list isn’t doing anything, so the ul itself can do that work.

<ul class=“list”>
blah blah…
</ul>

.list {
list styles you have (except the absolute positioning, don’t see where that’s being a Good Thing there…)

*edit I know why the header’s overlapping, I don’t have the font you expect… see below

I suppose it might be good to see a graphic showing how it should look. It certainly does look like it’s getting styles.

Does the reduction in code make a difference or is this more to do with trying to get best practice for when I build gigantic websites because then it will make a difference.

Well code reduction itself is good because lower filesizes anywhere are “generally” a Good Thing.
But yes the best reason is maintenance. Gary Turner (a member here and other forums) likes to say “Code as if the guy coming after you to maintain the code is a psychopath who knows where you live. In many cases that will be you.” : ) It’s easy enough to forget what you were thinking when you come back to unclear code a few months later.

The float problem has not appeared that you were discussing with Paul O’B but I haven’t tried it in IE6 or 7 and the float boxes are the same size. Do I need to do anything regarding this?

I’m not sure. Since the boxes are all the same height, the lack of clearing and the fact that they are ALL floating should mean that, so long as .wrapper remains “tight” enough around them that they can’t fit three in a row, they should look alright.
If the boxes were different heights, instead of the clearing float starting the rest on a new line, IE would let them ride up as high as they could go instead of staying at the height of the new line. Which is what happens when you don’t clear floats in other browsers too. Now, it is possible to use the width of the container (wrapper) to keep it impossible for floats to go to three in a row and so you’ll always have float drop and the equal heights means you won’t have any float snagging… so possibly you could get away with NOT clearing these boxes because they are same-dimension floats in a fixed-width container. I still would, but I guess you’ll have to see if IE is a b*tch with this or not. If it’s a problem then we may have to do some other solution.


.newprice{
	background-position: 0 0; 
	background-image:url(images/paying.gif); 
	background-repeat: no-repeat;
	
}

You can make even less code by using the background shorthand: background: url(images/paying.gif) 0 0 no-repeat;

Also I think it has twigged that I need to look through my code to see what is the same throughout and then just have it linked to one class to again to reduce code bloat, is that right?

twigged got me confuzled but then I am not the brightest marker in the pack but yeah, looking to see where stuff can be grouped together is generally a good thing for a web developer to do… BUT

It’s a biggish But.

This is the thing: we say, build for the future. Make it like CSS Zen Garden so you don’t have to change HTML when a new style is requested by the client.
In the real world this rarely happens: often HTML changes as well (mostly because content often changes when style changes). So, it’s more like a wishful ideal we build towards, while knowing it’s a sort of myth in reality. Not that it doesn’t have its benefits, as I said earlier: smaller filesizes etc.

You’ll notice however that when you group things as much as possible, you are making the code less flexible. Take a look at the basic Drupal theme. It’s awful: a bazillion classes on everything, every bit of text has 15 containers around it, always a bazillion times more code than necessary for what you see on the screen. Why? Because it’s a template; it’s flexible. If you are building something that you KNOW will be changed, and changed a lot by someone else (this happens when you’re building a “theme” for something, like WordPress, or often if your client will be using a CMS (with built-in WSYIWYG editor) to manage the content. They’ll come up with content you didn’t have access to when you were setting up the design, and your code won’t have any native way to deal with that when it’s optimised code for the content you do have).

So, if you will be the only one dinking with the front-end code of this site, then it’s a good thing to make it as lean as possible. If this were a theme for others to download and use, you can’t write like that. You have to write like more code == more money or something… write like we’re saving the universe by filling it with as much code as possible. Your bandwidth provider will thank you for the higher payments you’re making : ) but that’s how those things work as I understand it.

The area covered problem was because your browser wasn’t working with the leaguegothic font, this is a @fontface set up so not sure what caused the problem, have you any idea?

Ah, yes: I’m not allowing @font-face, because for some reason on my browser it seems to need Javascript to run even though @font-face itself is CSS.
http://stommepoes.nl/anna-1.png
http://stommepoes.nl/anna-2.png
Some users won’t be able to accept @font-face (even though I now see you’re using pie.htc… that’s good for IE but it will get missed by IE without Javascript and it will not do anything for older versions of the Modern browsers), so even when calling “leaguegothic” you’ll want a regular font stack behind it (I see now you have “arial narrow” but that’s not necessarily common either… I don’t have it). Do a whole font-stack with common web fonts and just check your page in them to see what the damage is. LeagueGothic looks like a narrow font so this would be why everything fits when that font is able to be rendered. I’m not sure what you can do there other than either:
let users without a narrow font on their systems get text popping out a bit (this could be seen as artsy on this page, so not necessarily a horrible problem except where text covers text) OR you could possibly choose to use Javascript to change the font-size so users without JS (likely also not having LeagueGothic appearing either) get a smaller font-size while those with JS on get the size that works with League Gothic.
Or, you could let the h2’s height push down the list. If the list weren’t absolutely positioned, it would go down further when the font was shown bigger, and would ride back up when League Gothic was appearing. This way, it wouldn’t matter at all if League Gothic worked or not. This means #mainbox would have to have" min-height" instead of “height” (and then a special message for IE6, who does not understand min-height).
Basically this is a classic decision web builders make every day: how much work do you consider worthwhile to support things you want that are not universally supported?
I don’t support Netscape 4 or 7, Mosaic, or IE5 for Mac (I don’t even have access to those browsers for testing anyway), and that’s a place where I’ve drawn my lines. Often I don’t support IE5 (sometimes I do, for fun or whatever). I support javascript-disabled all the time (I have not ever built a page whose only purpose was showing off cool design things, movies, games, or other Javascript-dependent content… those pages of course have no point in supporting non-js user agents, do they?), IE6 and up, and lack of things like newer CSS3 properties.

With CSS3 I often just use it to add a little extra “for those who can”. This means I do not allow the lack of CSS3 support to break the page. There’s a page done by John Allsopp which I like to look at because of how it degrades without scripts or CSS3 (it used to break layout when you didn’t have Javascript because of the jQuery slideshow but that’s been fixed): http://ampedweb.org/

Check that page out in IE8 or IE7 (I didn’t look to see if he bothered supporting 6). It’s a little dull, but fairly awesome. Again, the font at the top is set to a large font-size; this means in my browser it’s too big and goes slightly off the screen, but it’s still readable and can be forgiven by being “artsy”. That art-fart argument can be a great excuse if the site it right for it. Yours certainly qualifies: anyone seeing text where maybe one would think it doesn’t belong may well rationalise that it must be part of the design. Nothing wrong with that necessarily.

Anyway, you the developer will be deciding what you support… some devs actually tell clients they’ll charge more for IE6 support. Everyone has their limit. I don’t believe it should be much or any extra work to build pages that work without Javascript, the latest CSS, or images… it should not be more work (other than some testing) to make pages accessible in general either. If it’s a lot more work then you’re probably making it more work than necessary (however in your case you are starting out… everything will be more painful for you at the moment. Later, you’ll be whipping these things out easily).

The Here we go should only show for a few seconds whilst the google map is loading, does that mean the google map didn’t appear for you?

When I go to a browser that has all Javascript on, yes. When scripts for YOUR domain are allowed but not google, I do get boxes spilling out of the pink box… however I wouldn’t worry about half-scripts showing up (except to make sure all your scripts are getting loaded, no typos or whatever).

The google map was just something I stumbled upon when trying to find how I would add the map to show a boundary, do you know what the best way is to add it?

Well, I think the best way to add it is to use the GoogleMaps API where users without JS get an image of a map, but while my colleague did that on our sites, I dunno nothin about how the whole GoogleMaps API thing works. So maybe you could hack a version yourself: have an image of the maps, and lets the Google Maps just cover it up by absolutely positioning it over the box holding the image or something. Also, if you have written directions somewhere, you should provide those somewhere. If that breaks the “look” you’re going for, make a small link somewhere… takes users to another page that does have the directions in plain text. This way, those who don’t have images get directions and an address; those who have images but no Javascript get directions, an address AND a map (they can also go to google themselves and type in the address: you do get some crappy low-grade map you can use if you don’t have JS on); those with everything on get what you were shooting for: the whole interactive map thing (and directions as an option and an address of course).

For max-width, you’d be changing some things in .wrapper mostly, but since the header’s not in the wrapper you’d have to address the header separately.

Often developers will have a whole-page wrapper thing which allows them to set total page width and any side margins or whatever, and if they set max-width on it, after the browser is wider than that, there’ll be space growing on either side… if they set a min-width, browsers smaller than that get a scrollbar. Some of the mobile browsers suck balls with their scrollbars.

I really appreciate it, having read through it all I think it is going to take me quite some time to sort. I will come back with progress as I go along.

I’m not saying it’s bad, I’m just spewing my Not-So-Humble-Opinion all over it : )

It’s my word against… someone else’s. Except the errors, and again most of them seem to be from Google (you might be able to fix those manually by changing &'s to &amp’s but then test the urls do whatever you wanted them to do).

I have now updated the site with the changes I have made

I am going to have a play arond with this and see if I can make sense of it

Everything you have said about javascript makes sense and is something I am definitely going to have to consider if I want to do things the right way.

I will have another go at this once I have got the menu bar set up and working as one sprite so it may be while yet

That makes me feel a bit better I am putting evry spare hour into it but it is just time before work and during lunch and then a couple of hours at night and the weekend. Also I have no design background and so using things like photoshop has taken me ages to get my head around just producing simple things such as the multi coloured border at the top of the page took forever,

I have read the Ian Lloyd book, it got me on my way, I just feel there is a lot of the fundamentals that didn’t sink in and wonder if I might be better taking a step back for a couple of weeks when the site is finished and doing a bit of refresher as I do feel I am better placed to now take it all in. I was considering the CSS course here but I have looked at the HTML Utopia book extracts before and was interested in reading it I was just a bit concerned about the fact that it is like 5 years old and worried that it may be out of date. I am starting to get the impression that a lot of the fundamental techniques haven’t changed for some time (and won’t until CSS3 is fully implemented)

This feels like a big problem that I face as well, the smallest thing I want to produce seems to be extremely time consuming and difficult to achieve. I have improved a lot but it has been very slow

Luckily I am producing this site for my sister as a surprise so no pressure in terms of timescale. The next site I make will be for me with an aim to build a site where I can drive traffic to it and make money from it either from ads or by selling it. Either way I have set myself a target that in five years time I will be making more money doing this in my spare time than I earn in my real job and therefore can go into it full time. I assume that is realistic but I haven’t figured out how I am going to make a living out of it yet, I’m sure it will come to me.

Anyway thanks again, I better get off and start working on that menu bar, I’ll let you know how I get on

Wow thanks ever so much for spending so much time going through it, I really appreciate it. I haven’t read all of it but I am on my lunch now so will work through it. I knew it would be bad but didn’t realise it would be that bad.

I’ll post up in a bit how I have got on.

Thanks again

Hey Stomme Poes

Thanks again for taking the time and effort to put such a detailed post together, hope you enjoyed the conference. Any conference which involves you drinking lot’s of beer and then seeing sharks with laser eyes sounds brilliant

I have been working on this for a couple of hours today and will be working on it over the next few days. I’ll come back again when done but you are right in what you say

so it could be some time longer.

Thanks again