Possible Duplicate:
Why does it matter that HTML and CSS are not programming languages?

As I understand a programming language is something that can be used to solve a problem/perform an alogrithm. Then someone just said to me "I programmed a website using HTML, JavaScript, and CSS", and my immediate reaction was HTML and CSS are not programming languages, then remembered the L in HTML means Language. But still it is a "Markup Language".

So are CSS and HTML programming languages? If they are they can't be in the same boat as languages like C. In languages like C the order of instructions is crucial, but in CSS you can have rules and selectors in any order, and in HTML the order of the tags matter, so there must be some sub-classification of languages, where CSS/HTML/similar are in one and C/Python/etc are in the other?

  • 1
    What do you think you mean by "programming language"? Do you mean a "Turing Complete" language? Or do you mean "something can be used to solve page layout problems?" Or do you mean "something that can be used to represent information"? – S.Lott Jan 9 '12 at 0:05
  • I thought it meant something that can implement an algorithm? – Jonathan. Jan 9 '12 at 0:10
  • @Dean, sorry I didn't see that, however what does it mean by declarative and imperative – Jonathan. Jan 9 '12 at 0:10
  • 2
    Declarative is when you say "this is what I want to happen." Imperative is when you say "this is how I want to do this." For example, in CSS you would say "this paragraph should have a blue border" (declarative) whereas in Javascript you might say "draw a blue line from (x1, y1) to (x2, y2), etc" (imperative). – Dean Harding Jan 9 '12 at 0:30
  • No, they're just text markup and style hinting. While CSS may use some elements that are structured like bash scripting, it's just an identifier followed by a semicolon delimited list within curly braces. HTML is like the early days of WordStar when you could hand enter markup and then flip back to simulated page display. The biggest problem I'm facing at the moment is interviewing people who think they're programmers because they can design web pages in Notepad+. Now Javascript is an actual language you can do stuff with... – Fiasco Labs Jan 9 '12 at 0:31

Technically yes, but it wasn't really designed to be one.

CSS+HTML actually is turing complete because you can encode Rule 110 in CSS.

That said, it would be prohibitively impractical to try to write programs in HTML and CSS.

People who say they program in HTML are generally mistaken about programming. HTML is a markup language and CSS is a style sheet language. HTML is designed to store content hierarchically and CSS is designed to customize how the content is displayed. HTML and CSS are meant to express presentation, whereas code typically is written to do something, that is, to have some sort of function.

| improve this answer | |
  • 1
    Would downvote, purely because you neglected to mention this was "HTML5" and "CSS3". Took me on a merry journey. – JackWilson Nov 20 '13 at 11:00
  • 6
    @jackwilson HTML5 and CSS3 are the current versions, is there a reason to expect otherwise? – Peter Olson Oct 2 '15 at 0:16
  • Why do you not consider making some pixel on the screen red "some sort of function"? Are you saying that if I do this by calling setPixelColor from my procedural program then it is a function, but I do exactly the same thing by giving a rule background-color: red it is not? – user42386 Oct 20 '15 at 4:40
  • -1 Your link provided does not prove that CSS is Turing complete, there is much debate in that link as to whether the implementations provided actually satisfy Rule 110. Thus the "technically yes" bit of your answer is unsupported. – y3sh Apr 9 '16 at 15:16
  • @y3sh please read again this answer and linked source. The intent is not to prove CSS is Turing Complete! – Andre Figueiredo Jul 6 '17 at 14:06

No, CSS is a style sheet language which describes the appearance of markup (text with contextual definitions called "tags"). I've never met an experienced programmer who considers CSS/HTML programming languages. Doesn't mean you can't do cool stuff with them (especially HTML5/CSS3), but they don't particularly, logically instruct the computer to perform specific calculations and operations.

| improve this answer | |

No: (as I understand this), absence of for/while loops and if statements. Generally when "programming language" is mentiones, means Turing complete Programming language, one link here.

CSS, XML (therefore HTML) are markup languages.

| improve this answer | |
  • 3
    CSS isn't a markup language, it's a stylesheet language. You don't write markup in CSS. – Peter Olson Jan 9 '12 at 0:43
  • 1
    @PeterOlson Correct... How could we say that this makes it "more" a markup than a turing complete one? – Dimitrios Mistriotis Jan 9 '12 at 9:50

Cascading-Style Sheet or CSS is not a programming language. It is a mark up language used with HTML to design the user interface of a website (the style is applied to the mark up language through out the same sections of similar parts).

Programming languages have the ability to perform algorithms to calculate equations or perform low level machine based operating instructions and tasks.

| improve this answer | |

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