HTML Attributes

HTML Attributes

HTML attributes provide extra information about an HTML element. They are always written in the start tag and usually come in name=”value” format.


Example


 

  • href is the attribute

  • "https://google.com" is the value


Common HTML Attributes

Attribute Used With Purpose
href <a> Defines the link URL
src <img> Defines image file path
alt <img> Provides alternative text
style Any tag Adds inline CSS styling
id Any tag Unique identifier
class Any tag Used to group elements

Another Example


 

Here:

  • src, alt, and width are attributes.


Attributes make HTML elements more meaningful and functional.

CodeCapsule

Sanjit Sinha — Web Developer | PHP • Laravel • CodeIgniter • MySQL • Bootstrap Founder, CodeCapsule — Student projects & practical coding guides. Email: info@codecapsule.in • Website: CodeCapsule.in

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *