1

I am very new to HTML and CSS but while learning I ran into something that I was curious about. How come when you want to style or change font size etc. you use :.

Example: style="color: red; font-size: 50px".

But when you want to link to let's say your stylesheet you use =.

Example: link type="text/css"; rel="stylesheet"; href="stylesheet.css".

What's the difference? Because basically when you say color: red, your saying you want the color to = red, so why not just use that? This is just a curiosity thing nothing serious but your answers are appreciated.

2

When you use :, it's CSS. When you use =, it's HTML. It's just two languages with each one has its own different method for assigning attributes (HTML) and properties (CSS).

  • Quick response, Thank you. Also thank you for editing my post I don't know how to make it look like that but I'll figure it out and make sure future post are easier to read. – TheFlyingByrd Feb 18 '14 at 21:29
  • No problem and welcome to Pro Webmasters. – Zistoloen Feb 18 '14 at 21:37
  • 3
    Neither HTML nor CSS has variables; they are not programming languages. HTML has attributes, CSS has properties. But it is indeed a matter of simple syntactic difference between the two languages. – Jukka K. Korpela Feb 18 '14 at 21:44
  • @Jukka K. Korpela: You're right, I have edited my answer. – Zistoloen Feb 19 '14 at 8:38
1

Each programming language has its syntax.

For HTML, styles' properties are defined by

property_name: property_value 

And also for HTML, markup properties are defined by

markup_name = markup_value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.