1

Can someone explain me, what is better? Nowadays, we have HTML 4,5 that we can do this:

<p style="color: #3377ff; text-size: 25px"> Hello World! </p>

If today we can do the style in the HTML file, why we should make another CSS file?

Another question:

What is better? To make a

<style>

........

</style>

inside the same HTML file, or another CSS file with all our CSS?

Thanks!

Alex Kordatzakis
  • 25
  • 1
  • 1
  • 10

2 Answers2

0

Having a separate CSS file allows you to reference the same set of styles from multiple html files.

Gene
  • 57
  • 6
0

All three ways are possible (inline styles via style attribute, <style> tags in HTML and separate CSS files). But many developers prefer to keep their styles in separate CSS files to keep HTML more readable.

Sometimes you need to add many attributes to HTML tags, and it will become really unreadable with inline style.

If you already have a huge HTML file, <style> tags usage will make it more huge and it's uncomfortable too.

So, better use separate CSS files for the main part of your styles.

Commercial Suicide
  • 14,875
  • 14
  • 62
  • 80