Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

How to Add Audio in HTML Using audio Tag

How to Add Audio in HTML Using audio Tag


html audio tag



Learn HTML audio  Tag 

The <audio> has been added to HTML5 to allow embedding audio files to a web page.

  not all browsers support all audio format the audio file is encoded using special codecs.

 The <source> tag or the src attribute is used to indicate the variations of the same audio file.

 The path to  audio file can contain absolute  and relative URL.

Syntax: The <audio> tag comes in pairs; the content is written between the opening (<audio>) and the closing (</audio>) tags.

Syntax 

<audio controls>
 <source src="/desktop/audio_friendship.mp3" type="audio">
</audio>

Learn HTML audio  Tag 

Example 

<html>

Click the play button

 <title>Title of the document</title>

 <head>

 </head>

<body>

<audio controls>

 <source src="/desktop/audio_friendship.mp3" type="audio">

</audio>

<P>click the Play button</p>

</body>

</html>

Learn HTML audio  Tag 

Explain program 

Step 1 ]

<!Doctype html>

  • <!doctype html>  always be the first line of any HTML document.

Step 2 ]

   <html> and </html>

   html  is the root element.

Step 3 ]

<body> and </body>

body  is  main content area.

All visible content inside to  the <body> tag

Step 4]

<audio controls>

create audio player the page

controls attribute add play/pause button

Step 5]

<source src="/desktop/audio_friendship.mp3" type="audio">
 
src   :-  file pointer to the location (here desktop/audio_friendship.mp3)


Learn HTML audio  Tag 

Output 

learn html Audio Tag

Related Post :-




Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example