loading...

Discussion on: Are CSS and HTML programming languages?

Collapse
leoat12 profile image
Leonardo Teteo

No, they are not. That's why Javascript exists, a HTML page without a true programming language is as static as an image, there is not control flow or any dynamism like other programming languages.

Collapse
alvaromontoro profile image
Alvaro Montoro

You can have control flow in HTML and CSS by using radio buttons (and event without them). You can create a FSM/automaton with HTML and it will work as well as with JavaScript. It may not be practical, but it can be done.

Collapse
leoat12 profile image
Leonardo Teteo

I understand that you are talking about like changing the style of something based on the radio button, right? Together they can do such thing, but each one of them cannot be considered a programming language, HTML or CSS alone cannot do much as far as I know. Unless a FSM/automaton can be done exclusively with HTML, can you tell more about it? I didn't know about that.

Thread Thread
alvaromontoro profile image
Alvaro Montoro

That's a good point. A FSM/automaton could be built using only HTML with links and IDs/anchors... Again, it wouldn't be practical or pretty, but it could be done. But then someone will claim that it is really a simulation, or that they don't like it.

Thread Thread
johncip profile image
jmc

I help out with an after-school program where, early in the curriculum, we teach the students to make HTML "choose your own adventure" games. (I made this one). It's useful for that, at least :P

(We use separate pages rather than links to fragments on the same page.)

And they are roughly like FSMs, though I think of FSMs as having an input vocabulary that's separate from the states. For instance, with a dial-type combination lock, you can pick any number on any step. With a tree of links, you can think of each page's links as representing a 0, a 1, etc., but it's not "the same" 0 leading out of each page. (You can link to the same destination from multiple places, but that's just going to the same state.) Hopefully I'm making sense. Maybe that lack of a separate input vocabulary just means they're more like Mealy machines than Moore machines? I'm not sure.

They also feel like decision trees to me, FWIW. It could be that there's some formal correspondence between the two concepts, but it's sadly not my area :P

You may be interested in the HTML/CSS game The Mine -- the top code comment makes it sound like it might just be a big FSM made out of checkboxes. I haven't tried to confirm that though.

Thread Thread
alvaromontoro profile image
Alvaro Montoro

That’s what I was referring: each page is a state, each link is a transition, and the input is the user clicking on a link. And that can be achieved with HTML even without CSS. (Although CSS will make it prettier 😊)

Collapse
citizen428 profile image
Michael Kohl

github.com/kkuchta/css-only-chat, impractical for sure, but not "as static as an image". Neither are keyloggers in pure CSS (aka CSS exfiltration) that have been around for a long time and use a similar principle.

Collapse
leoat12 profile image
Leonardo Teteo

I don't know Ruby, but using Ruby in anything doesn't defeat the purpose of being CSS only? Like, if he uses something other than CSS, it is not CSS-only anymore.

Thread Thread
citizen428 profile image
Michael Kohl

He uses Ruby to have a webserver that serves the HTML and CSS.

Thread Thread
leoat12 profile image
Leonardo Teteo

So it is like any other web application that has a programming language with a server that serves HTML and CSS?

Thread Thread
citizen428 profile image
Michael Kohl

Ok, I missed the server.rb file before, there are some shenanigans going on with serving the images. But to be honest, the main point was that "static like an image" hasn't been accurate for quite a while, as this example maybe illustrates a bit better:

codeburst.io/mario-kart-css-7572bd...