Old 03-03-2008, 09:19   #1 (permalink)
adam c
berserker than thou
 
adam c's Avatar
 
Join Date: Sep 2005
Location: Bristol
Posts: 450
rip my code apart

Hi all,
I'm really trying to improve my front end coding practices.
If anyone's got time could you take a look at this test page:
A website
and let me know any XHTML or CSS you think might be incorrect or wrongly implemented or just could be coded better.
Cheers guys.
  Reply With Quote
Old 03-03-2008, 09:22   #2 (permalink)
d3mcfadden
Senior Member
 
d3mcfadden's Avatar
 
Join Date: Apr 2005
Location: -
Posts: 694
Send a message via AIM to d3mcfadden
Here is the only thing I see (in about a 5 second glance) in your html:
HTML Code:
<li><a href="#">Lorem ipsum dolor sit amet</a></li> <br/> <- not valid </ul>
  Reply With Quote
Old 03-03-2008, 09:31   #3 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
Or necessary. Should also have a space between the r and the / to avoid backward compatibility issues.

Also, images-as-text. Tsk, tsk.
  Reply With Quote
Old 03-03-2008, 09:59   #4 (permalink)
adam c
berserker than thou
 
adam c's Avatar
 
Join Date: Sep 2005
Location: Bristol
Posts: 450
Thanks guys. I'll take out the br tag and put in some padding instead.
Hmm, I see what you mean about the images as text. What would you do if the client has asked for a specific, non-web friendly typeface though? Would you advise them against it or do some sort of image replacement (of which I have no experience, I've only heard other people say it)?
  Reply With Quote
Old 03-03-2008, 10:05   #5 (permalink)
niggle
Senior Member
 
Join Date: Feb 2008
Posts: 438
Quote:
What would you do if the client has asked for a specific, non-web friendly typeface though?

Remember that search engines and validators can't recognise a heading. All they know to look for is keywords, tags and so on. So your graphic headings might well be the headings for your human viewers, but you can duplicate them elsewhere with tags and so on for your non-human ones.
  Reply With Quote
Old 03-03-2008, 10:16   #6 (permalink)
Dusteh
Sir digby chicken caesar
 
Dusteh's Avatar
 
Join Date: Sep 2004
Posts: 4,051
You could use sIFR on your H tags like everyone else.

Or basic css image replacement. Set the background for the text being replaced to the image, give the container a width and height, set your overflow to hidden, offset the text by -9999px - job done.
__________________
unconsolidated isoparms
  Reply With Quote
Old 03-03-2008, 10:25   #7 (permalink)
d*d
Senior Member
 
d*d's Avatar
 
Join Date: Oct 2004
Location: Bristol
Posts: 3,060
Quote:
Originally Posted by niggle
Remember that search engines and validators can't recognise a heading.
<h1>
  Reply With Quote
Old 03-03-2008, 10:46   #8 (permalink)
adam c
berserker than thou
 
adam c's Avatar
 
Join Date: Sep 2005
Location: Bristol
Posts: 450
Quote:
Originally Posted by Dusteh
You could use sIFR on your H tags like everyone else.

Or basic css image replacement. Set the background for the text being replaced to the image, give the container a width and height, set your overflow to hidden, offset the text by -9999px - job done.

Thanks Dusteh. I'll look into this.
  Reply With Quote
Old 03-03-2008, 10:52   #9 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
Quote:
Originally Posted by adam c
Thanks guys. I'll take out the br tag and put in some padding instead.
Hmm, I see what you mean about the images as text. What would you do if the client has asked for a specific, non-web friendly typeface though? Would you advise them against it or do some sort of image replacement (of which I have no experience, I've only heard other people say it)?
Image replacement is great. I've never bothered using sIFR - mostly because I don't have Flash.

Anyway, there are lots of image replacement methods. The one I generally use requires extra markup, but there are other methods - I'm just a creature of habit.

HTML Code:
<h1><span>Heading</span></h1>
Code:
h1 { width: XXXpx; height: YYpx; background: url(/path/to/image.png) no-repeat top left; } h1 span { display: block; width: 0px; height: 0px; overflow: hidden; }
Probably more preferable is...

HTML Code:
<h1>Heading</h1>
Code:
h1 { width: XXXpx; height: YYpx; background: url(/path/to/image.png) no-repeat top left; text-indent: -9999px; overflow: hidden; }
That should work.
  Reply With Quote
Old 03-03-2008, 11:04   #10 (permalink)
Dusteh
Sir digby chicken caesar
 
Dusteh's Avatar
 
Join Date: Sep 2004
Posts: 4,051
Yeah I think the second one is better because you don't need the extra markup. I've yet to see it fail on any browsers.
__________________
unconsolidated isoparms
  Reply With Quote
Old 03-03-2008, 11:11   #11 (permalink)
d*d
Senior Member
 
d*d's Avatar
 
Join Date: Oct 2004
Location: Bristol
Posts: 3,060
text-indent: -9999px;

I've never been entirely happy with that though
  Reply With Quote
Old 03-03-2008, 11:34   #12 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
What happens when I get a monitor that runs 12800x10240, huh smart guy?!
  Reply With Quote
Old 03-03-2008, 11:35   #13 (permalink)
adam c
berserker than thou
 
adam c's Avatar
 
Join Date: Sep 2005
Location: Bristol
Posts: 450
Thanks pgo.
I take it the text-indent value is so that you will definitely not see the text unless you have images turned off?
  Reply With Quote
Old 03-03-2008, 11:38   #14 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
No, it just pushes it off the screen. Images off/CSS on will show nothing - like most IR techniques.

There's several methods detailed: mezzoblue § Testing Grounds
  Reply With Quote
Old 03-03-2008, 14:19   #15 (permalink)
Mongoose
Senior Member
 
Mongoose's Avatar
 
Join Date: Oct 2007
Location: Olympia, WA
Posts: 151
Send a message via AIM to Mongoose
There's no need to have two divs for your header. Get rid of either topBar or topImg.

You should try to name your divs a bit more semantically:
div#topBar --> div#branding
div#rightNav --> div#sidebar
div#footer --> div#siteInfo
  Reply With Quote
Old 03-03-2008, 14:39   #16 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
I don't know, I've had a few cases where I needed to create one or two extra non-semantic <div>s or <span>s. It's not a crime against humanity, really.
  Reply With Quote
Old 04-03-2008, 00:44   #17 (permalink)
Mongoose
Senior Member
 
Mongoose's Avatar
 
Join Date: Oct 2007
Location: Olympia, WA
Posts: 151
Send a message via AIM to Mongoose
Quote:
Originally Posted by pgo
I don't know, I've had a few cases where I needed to create one or two extra non-semantic <div>s or <span>s. It's not a crime against humanity, really.
Well, yeah. At the end of the day, it doesn't matter. Just makes the code more human readable.
  Reply With Quote
Old 04-03-2008, 09:56   #18 (permalink)
adam c
berserker than thou
 
adam c's Avatar
 
Join Date: Sep 2005
Location: Bristol
Posts: 450
Quote:
Originally Posted by Mongoose
There's no need to have two divs for your header. Get rid of either topBar or topImg.

You should try to name your divs a bit more semantically:
div#topBar --> div#branding
div#rightNav --> div#sidebar
div#footer --> div#siteInfo
I think I understand why you're saying there's no reason for both of these divs but what I'm trying to do is have a white bar the entire length of the browser and an image aligned off the left hand side of the centered box below. Can I still do this with only one div?
  Reply With Quote
Old 04-03-2008, 10:45   #19 (permalink)
Dusteh
Sir digby chicken caesar
 
Dusteh's Avatar
 
Join Date: Sep 2004
Posts: 4,051
I wouldn't worry about it.
__________________
unconsolidated isoparms
  Reply With Quote
Old 04-03-2008, 11:36   #20 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
Quote:
Originally Posted by adam c
I think I understand why you're saying there's no reason for both of these divs but what I'm trying to do is have a white bar the entire length of the browser and an image aligned off the left hand side of the centered box below. Can I still do this with only one div?
I can't think of an easy way. I did that recently using almost the same markup.

HTML Code:
<div id="banner-parent"><div id="banner">Site Name</div></div> <div id="wrap" class="clearfix"> ...blah... </div>
Not ideal, but not too bad. Site name is replaced by a logo.

Code:
#banner-parent { width: 100%; height: 100px; border-bottom: 25px solid #FFF; background-color: #084A8E; } #banner { width: 650px; height: 100px; margin: 0 auto; background: url(logo.gif) no-repeat 25px 50% #084A8E; text-indent: -99999px; }
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8