What is a <style> tag?

Experience Level: Junior
Tags: HTML


The <style> tag is used to define styles for the HTML document. It usually contains CSS styles.

  • It is a best practice to put the <style> tag to the <head> element. It can be present in the <body> element as well, but placing it to <head> element is preferred.
  • The content of the <style> tag can be present either directly in the document (embedded) or it can be linked from the external file.
  • Linking the styles from the external file is the preferred method as the external file can be downloaded just once and then cached, so less data need to be transferred on subsequent web page loads.
  • There can be multiple <style> tags present in the HTML page.
Example of the linked style content
<style src="styles.css" />
Example of the embedded style content
	.mystyle { color: red; }
Related HTML job interview questions


No Comments Yet.
Be the first to tell us what you think.
HTML for beginners
HTML for beginners

Are you learning HTML ? Try our test we designed to help you progress faster.

Test yourself