Dev.to WebDev 🛠 Dev 👁 1 📖 1 min read

Html and CSS attributes

HTML Attributes:-Attributes provide additional information about elements,it usually come in name/value pairs like: name="value" Some of the attributes are:- Href Attribute:-The a tag defines a hyperlink. The href ab

HTML Attributes:-Attributes provide additional information about elements,it usually come in name/value pairs like: name="value"

Some of the attributes are:-

  • Href Attribute:-The a tag defines a hyperlink. The href abbreviation is hyper reference which gives a tag with additional information and helps to redirect another web page

Example

<a href="https://www.google.com">google</a>
  • Src attribute:-The img tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed:

Example

<img src="img_bike_honda_cbr.jpg">

Width and Height attribute:-width and height attributes can specify the width and height of the content and can be used in both html and css

Example

<img src="img_honda_cbr.jpg" width="50" height="60">

Alt attribute:-alt attribute for the img tag specifies an alternate text for an image, if the image for some reason cannot be displayed, This can be due to a slow connection, or an error in the src attribute

Example

<img src="img_mazda_787b.jpg" alt="Car thumbnail">
  • Style attribute:-The style attribute gives the entire access to the css properities and act as a inline css to the document,user can modify the size,color,font etc

Example

<p style="color:red;">This is a red </p>
  • Type and Placeholder:- these two attributes are used in the input tag ,usually for specify which type of input is used, like text,email,password,number.

Example

<input type="text" placeholder='Enter your username here'>
📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.