+ 1

Can CSS Work Without HTML?

We know that HTML defines the structure of a webpage, while CSS controls its design. But is it possible to use CSS without HTML? What happens if we use only CSS? Can CSS work with other languages like JavaScript or XML? If CSS depends on HTML, why are they considered separate technologies? https://sololearn.onelink.me/MfgO/h4rymvb7

16th Mar 2025, 12:58 AM
Sadamhussain sanggen17
Sadamhussain sanggen17 - avatar
4 Respostas
+ 5
Sadamhussain sanggen17 yes but even when not directly using HTML tags, CSS always needs a structured document to work with.
16th Mar 2025, 1:09 AM
BroFar
BroFar - avatar
+ 4
have you tried it? it's easy... just delete everything inside the <body></body> tags. then you see what happens. css works with Js. But without any html, you end up generating the html with js. So you still have html. css works with xml, because xml, like html, provides the structure for css to be applied to. https://www.geeksforgeeks.org/displaying-xml-using-css/ you can also use css with svg. https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_and_CSS#simplified_structure yes, they are separate technologies. html can work without css. css cannot work by itself. It needs to be applied to something.
16th Mar 2025, 1:08 AM
Bob_Li
Bob_Li - avatar
+ 4
BroFar yes, i saw that, too. it's a nice party trick. šŸ˜ but pseudo-elements are technically child-elements. css has been evolving a lot, it's becoming almost like a programming language. It has variables, you can calculate, do conditional selections, create pseudo classes and elements. so yes, maybe one day, we can build page content with css alone, which will certainly be borderline madness... https://weitzel.dev/post/css-programming-language/
16th Mar 2025, 2:35 AM
Bob_Li
Bob_Li - avatar