Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 2148 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Discuss the use of html elements

Thread title: Discuss the use of html elements
Closed Thread  
Page 1 of 4 1 2 3 4 >
    Thread tools Search this thread Display Modes  
06-04-2008, 02:08 PM
#1
vaLhak is offline vaLhak
Status: I'm new around here
Join date: Jun 2006
Location:
Expertise:
Software:
 
Posts: 15
iTrader: 1 / 100%
 

vaLhak is on a distinguished road

  Old  Discuss the use of html elements

Hey!

I've seen many people do some crazy coding(bad) and I don't know if I am doing wrong or they sometimes because it's so many that do the same.

An example:
PHP Code:
<div id="menu">
    <
ul>
        <
li>Test</li>
        <
li>Test2</li>
    </
ul>
</
div
Why not just write
PHP Code:
<ul id="menu">
    <
li>Test</li>
    <
li>Test2</li>
</
ul
And many people use javascript + pictures for :hover that easy could have been fixed in css only and they call themself professional.

So what are professional these days when I see of 60% are doing like these examples and there are more but I can start with these.

Best regards,
Marcus

06-04-2008, 05:01 PM
#2
Gille is offline Gille
Status: HTML & CSS Guru
Join date: Mar 2005
Location: Ghent, Belgium
Expertise: HTML, CSS
Software:
 
Posts: 1,226
iTrader: 13 / 100%
 

Gille is on a distinguished road

Send a message via MSN to Gille

  Old

I'm afraid it's something that's not easy to root out: people are forced to use div's so they use it for anything they can think off...

The Javascript thing is from the DreamWeaver era, which created that Javascript code.

Unfortunately, there's not much you can do about it... For a novice html user, this will look like normal and good code; of course, if you know what you're doing, you realise there are better ways to handle this.

The same goes for the whole valid xHTML & CSS... It's irrelevant wether it's valid or not, it has to be structured properly aswell.

06-04-2008, 05:27 PM
#3
Andrew R is offline Andrew R
Status: Request a custom title
Join date: Dec 2005
Location: Arizona
Expertise:
Software:
 
Posts: 5,200
iTrader: 17 / 95%
 

Andrew R is on a distinguished road

  Old

One reason, which usually isn't a valid excuse, for the first code is when they need two containers around the list items. This could be when they need a rounded-edge container that fits to exactly needed width (left image on div, right image on ul). But I think it's safe to say that only 0.1% of people using that code do that.

06-04-2008, 10:11 PM
#4
rochow is offline rochow
rochow's Avatar
Status: Member
Join date: Oct 2006
Location: Australia
Expertise:
Software:
 
Posts: 297
iTrader: 4 / 100%
 

rochow is on a distinguished road

Send a message via MSN to rochow Send a message via Skype™ to rochow

  Old

Sometimes you need a div around a menu for background effects. Mostly though, its just bad coding.

Why do all these "pros" do half the rubbish they do?

You are doing it right.

06-04-2008, 10:47 PM
#5
Jeff Andersen is offline Jeff Andersen
Status: Superstar
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 4,449
iTrader: 10 / 100%
 

Jeff Andersen is on a distinguished road

  Old

Originally Posted by rochow View Post
Sometimes you need a div around a menu for background effects. Mostly though, its just bad coding.

Why do all these "pros" do half the rubbish they do?

You are doing it right.
Negative, all those effects can be done via the UL.

06-04-2008, 11:04 PM
#6
vaLhak is offline vaLhak
Status: I'm new around here
Join date: Jun 2006
Location:
Expertise:
Software:
 
Posts: 15
iTrader: 1 / 100%
 

vaLhak is on a distinguished road

  Old

Nice to get some response, we can take another example.

I'v seen ppl adding this to their site to center their page.

Example
Code:
<div align="center">
    <div id="container"></div>
</div>
Please learn to use margin :=)

I blacklist alot of tags like <span><b><i><u><font> . if I find any of these tags in a code I think its noobish... Anyone feel the same?

06-04-2008, 11:05 PM
#7
Andrew R is offline Andrew R
Status: Request a custom title
Join date: Dec 2005
Location: Arizona
Expertise:
Software:
 
Posts: 5,200
iTrader: 17 / 95%
 

Andrew R is on a distinguished road

  Old

Wow, from looking at your site, rochow, you are one ****ing arrogant person. Especially from reading your HTML comments (Q&A). How you get any clients at all is beyond me. Also, in your code, I can see a bunch of unnecessary tags, empty ones, etc. so I don't see why you call yourself 'the best'.

vaLhak: You are wrong about span, in my opinion. There are several places where it is acceptable.

06-04-2008, 11:29 PM
#8
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

From experience it appears that the 'bad habits' that people pick up with regards to coding HTML documents stems from not appreciating what the markup is all about.

Coming at the HTML from the viewpoint of having a design and making that into a web page lends itself to getting things done via shortcuts (or longcuts!), incorrect tags, structures and patterns, etc. simply to achieve the visual effect intended.

I also think that the whole self-learning aspect through which many people learned to code (myself included) lends itself to picking up habits (good or bad) and sticking with them because they 'just work'.

06-05-2008, 12:01 AM
#9
Awesome is offline Awesome
Awesome's Avatar
Status: Pastafarian
Join date: May 2006
Location: Duct Taped to your Ceiling
Expertise:
Software:
 
Posts: 3,440
iTrader: 26 / 93%
 

Awesome is on a distinguished road

  Old

There are many situations where you may need/want to wrap the UL in it's own div. This can be related to JS, backgrounds, browser issues,

Originally Posted by Jeff Andersen View Post
Negative, all those effects can be done via the UL.
That's not really the case. Suppose you need two images (multiple backgrounds has very limited support), or the UL needs to be floated to the right? Or the UL needs a z-index but is absolutely positioned - in this case you'd need the div to apply correct z-indexing to ie6 which ignores z-index on an absolutely positioned element so the z-index must be applied to the parent (in this case the div).

There are always rules, exceptions, and rules with exceptions for the exceptions

06-05-2008, 12:17 AM
#10
rochow is offline rochow
rochow's Avatar
Status: Member
Join date: Oct 2006
Location: Australia
Expertise:
Software:
 
Posts: 297
iTrader: 4 / 100%
 

rochow is on a distinguished road

Send a message via MSN to rochow Send a message via Skype™ to rochow

  Old

Originally Posted by Jeff Andersen View Post
Negative, all those effects can be done via the UL.
No, they can't.

I have had many instances where 2 background images were required - 1 got slapped on the <ul> and 1 got put on the <div>

Closed Thread  
Page 1 of 4 1 2 3 4 >


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed