Welcome to WebmasterWorld Guest from 54.167.85.221

Forum Moderators: incrediBILL

Message Too Old, No Replies

What is the difference between Html Tag and html attribute?

     

ChrisBang123

3:18 am on Aug 1, 2013 (gmt 0)



Hi guys,

Please tell me the difference between Html Tag and html attribute.

Waiting for your answers...

phranque

5:12 am on Aug 1, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, ChrisBang123!


it's best described in the official HTML language reference in section on HTML syntax:
http://dev.w3.org/html5/markup/syntax.html#syntax-elements

JD_Toims

2:58 am on Aug 2, 2013 (gmt 0)

WebmasterWorld Senior Member Top Contributors Of The Month



The short version of the docs is:

This is an HTML element <p>
[change p to any valid tag and it's still an element]

This is an element with an HTML attribute <p class="some_class">
[change class="some_class" to anything else valid for the element being used or add another attribute="value" and those are it's attribute(s)]

lucy24

4:14 am on Aug 2, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Or:
<tag>
vs.
attribute = "some-value"

drhowarddrfine

1:18 pm on Aug 2, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is an HTML element <p>

To nitpick. <p> is a tag that represents an element.

DrDoc

3:38 pm on Aug 2, 2013 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



To nitpick. Some browsers have been known to have issues with
attribute[space]=[space]"value"
. It doesn't happen very often any more; I've only seen it a handful of times recently with empty attributes (i.e.
checked
vs
checked="checked"
). In other words -- it's best to not use spaces around the equal sign (=) separating the attribute from its value. Makes HTML parsing or regular expressions much easier as well. I know that HTML5 explicitly allows space characters (which, IMO is a bad move), but I still recommend against it.

JD_Toims

6:34 pm on Aug 2, 2013 (gmt 0)

WebmasterWorld Senior Member Top Contributors Of The Month



To nitpick. <p> is a tag that represents an element.

Okay, okay, okay -- How about 'Any valid tag is often loosely referred to as an element, even if the tag is not technically an element itself, while an attribute appears within a tag as attribute="value".'? (lol)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month