Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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).

share|improve this answer
    
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 at 21:29
    
No problem and welcome to Pro Webmasters. –  Zistoloen Feb 18 at 21:37
2  
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 at 21:44
    
@Jukka K. Korpela: You're right, I have edited my answer. –  Zistoloen Feb 19 at 8:38

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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