11 replies [Last post]
nevets2001uk
nevets2001uk's picture
Offline
Regular
UK
Last seen: 9 years 42 weeks ago
UK
Timezone: GMT+1
Joined: 2004-01-14
Posts: 29
Points: 11

I'm working on redeveloping a site in ASP.NET and also improving the layout so that it's more valid. The previous site is laid out mainly using tables.

I've got a working version online and I'm getting down to the nitty gritty part of trying to get everything as valid as possible and also cross browser display working. My main concern at the moment is the front page. Some of it doesn't validate as the code produced by .NET is a bit nasty in places.

My main problem is that it looks pretty much as I'd like in most browsers but the News gets shunted down in IE6. Also the paragraph of text below the flash image seems to have no top margin and I've tried numerous things to create some white space but it doesn't seem to move.

One thing that doesn't validate very well is a drop down menu I generated from a website. Is there some cleaner CSS / XHTML only code I could use to create a similar menu with cleaner markup?

I'm basically after any thoughts to improve the front page markup and CSS.

The WIP site is online at www.plmportal.co.uk/aessisdotnet

Cheers,
Steve

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 8 weeks 6 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2043
Points: 2268

What is this all

What is this all about:

<![if
                    gt IE 6]></a><![endif]><!--[if lte IE 6]><table><tr><td><![endif]-->

Quote:

Some of it doesn't validate as the code produced by .NET is a bit nasty in places.

Explain this. I've never turned out an invalid ASP.NET page.

nevets2001uk
nevets2001uk's picture
Offline
Regular
UK
Last seen: 9 years 42 weeks ago
UK
Timezone: GMT+1
Joined: 2004-01-14
Posts: 29
Points: 11

Thanks for your

Thanks for your reply

Verschwindende wrote:

What is this all about:

Quote:

Some of it doesn't validate as the code produced by .NET is a bit nasty in places.

Explain this. I've never turned out an invalid ASP.NET page.

It's not this page specifically but some of the controls seem to use tables in the markup they produce which makes styling the pages more messy than it needs to be. I'd prefer it if the controls produced markup without tables which I believe is a feature of .NET 4.0.

The code you quote is what was produced by the free dropdown generator for the menu I used. As I say it's very messy and I'd like to employ a neater solution if anyone has some suggestions.

Cheers,
Steve

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 8 weeks 6 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2043
Points: 2268

nevets2001uk wrote:... I'd

nevets2001uk wrote:

... I'd like to employ a neater solution if anyone has some suggestions.

Google "Son of Suckerfish" or "Superfish" if you'd like a jQuery version. I intended to put that in my first reply but it seems that I forgot. Tongue

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

we've talked about that

we've talked about that markup before and I've stated my absolute abhorrence of it.

It attempts to make drop down hover elements work in ie5/6 by adding invalid nested table markup.

It was devised by a CSSer of legendary repute, someone extremely well versed in CSS, he originally demonstrated this as proof of concept a test case theory and stated on his website it was not intended for real world production deployment, then a while later more and more people were copying his code and it appears that he has thought it okay to use in the wild Angry

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 8 weeks 6 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2043
Points: 2268

Yikes, who was it? Tell

Yikes, who was it? Laughing out loud Tell me, tell me!!!

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

it's Stu Nichols and if I

it's Stu Nichols and if I only had half his ability I would be happy however that doesn't change the fact that I have been at this a while and count myself as deserving of an opinion and in this instance I hate the whole notion of corrupting markup in this fashion, if IE is so dumb don't pander to it and destroy the markup use the conventional approach and apply a small snippet of JavaScript or the hover.htc file.

Other than that some of Stu's CSS examples are to be marvelled at and he is an extremely clever chap.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 8 weeks 6 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2043
Points: 2268

That's who I thought you

That's who I thought you meant. Wink

He is very brilliant and definitely deserves respect. Some of his experiments are never meant for the wild. He ranks highly on the search engines which attract his experiments to new folks.

nevets2001uk
nevets2001uk's picture
Offline
Regular
UK
Last seen: 9 years 42 weeks ago
UK
Timezone: GMT+1
Joined: 2004-01-14
Posts: 29
Points: 11

I've now updated the menu

I've now updated the menu with the help of a great free framework at http://www.lwis.net/free-css-drop-down-menu/

It appears to be working and the code is much cleaner than before. However I've noticed that the menu fails a bit in IE 6 and was wondering if anyone can see why?

Cheers,
Steve

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 8 weeks 6 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2043
Points: 2268

The site doesn't come through

The site doesn't come through on this end so I can't really comment on it as before.

Since I can't see your dropdown menu I can only suggest, as before, that you google "Son of Suckerfish" or "Superfish". Echo, echo. Tongue

Some tips for ASP.NET:

  • Only use the server side controls that are necessary, don't use <asp:label> for <label>, in fact, don't use any server side controls at all unless they need to be accessed in the code behind.
  • choose a control that outputs the least amount of code, for example don't use <asp:label> when you really need <asp:literal>
  • roll your own if necessary, example: don't use an <asp:login>, instead write a normal html form except for the button and check the input against Membership.ValidateUser in the codebehind.

I'm sure I could go on and on. Smile

nevets2001uk
nevets2001uk's picture
Offline
Regular
UK
Last seen: 9 years 42 weeks ago
UK
Timezone: GMT+1
Joined: 2004-01-14
Posts: 29
Points: 11

Thanks for the tips. Oddly

Thanks for the tips. Oddly enough I spent some time yesterday changing some labels to literals after noticing the annoying spans that had been generated! I'll try some of the other .NET suggestions to tidy things further.

I Googled and tried some of the suckerfish suggestions but couldn't work out the formatting to my liking but found a link to the dropdown framework in a forum somewhere and it was much easier to modify.

Hopefully the site is online again now. I believe the server was rebooted eariler

Cheers,
Steve

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 8 weeks 6 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2043
Points: 2268

Another point that I seem to

Another point that I seem to have taken for granted is to make sure to add <xhtmlConformance mode="Strict"/> to the <system.web> node of your web.config file. This will help by removing things like the name attribute from the form element and the border="0" from images.

If you haven't looked into "CSS friendly adapters" that is something to google and you can also add a w3 validator browser file to App_Browsers to allow for direct validation (it basically tells .NET to treat the w3 validator as an "uplevel browser"). If you can't find the w3cvalidator.browser file, let me know and I'll upload it somewhere.