HTML

Interview Questions on HTML

11. How would you display image in html?

By using <img> tag.
Ex :- <img src="w3schools.jpg" />

12. What is the use of ‘alt’ in <img> tag?

If browser is not supporting to display the image then alternatively browser will show that text which is assigned to alt attribute.

13. How to keep new line or break lines in html?

Use <br/> tag.

14. How would to keep more spaces in html?

By using ‘&nbsp’.
It stands for non breaking space.

15. What happens if we not close tags?

Closing tag is considered as optional.
Never rely on this. It might produce unexpected results some times.

16. Write html code for image which has 100px width and 150px height?

<img src=”image_to_link” width=”100px” height=”150px” />

17. How to write inline styles in html?

Use style attribute in tags.
Ex:- <img src=”link” style=”width:500px; height:500px;” />

18. How to not allow to modify input text?

Use ‘disabled’ attribute in the input box.
Ex:- <input type="text" name="inputname" disabled />

19. How to view the html source code of webpage in browser?

Method1 :- right click on webpage and click on view page source.
Method2 :- press ctrl + u
Method3 :- open developer tolls in settings.

20. What is the use of <pre> tag?

<pre> tag is use to display the text as it is where in <pre> tags.
Ex:- <pre> asdad a as</pre>


www.000webhost.com