homepage Welcome to WebmasterWorld Guest from 23.22.173.58
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
What is the difference between Html Tag and html attribute?
ChrisBang123




msg:4598302
 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




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

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




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

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




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

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

drhowarddrfine




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

This is an HTML element <p>

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

DrDoc




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

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




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

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)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved