Can HTML and CSS be in same structure? | Sololearn: Learn to code for FREE!
+ 2

Can HTML and CSS be in same structure?

I never knew it was possible to add <html> AND CSS within the same structure and elements without having them separated. I thought If I were to build a page, that I have to start HTML and work to CSS. I was messing with the code and came up with this and it works so far. <html><head> <style type="text/css"> body { font-size:16px; font-family:Helvetica; color:#dddddd; background-color:#111111; }

31st May 2019, 2:58 AM
Trashaune T. Jimmerson
Trashaune T. Jimmerson - avatar
2 odpowiedzi
+ 1
Yes it can be. Your <style></style> tags is where you can put all your css styling. Same with <script></script> where you can write jQuery and JavaScript code to execute on your webpage. However, it is best practice to keep your html, css and javscript code in different files as it becomes easier to maintain and keeps it nice and clean.
31st May 2019, 10:17 AM
Nico Engelbrecht
Nico Engelbrecht - avatar
0
Yes, there are 3 common ways to embed CSS into HTML. External style sheet: A separate document containing CSS Internal style sheet: CSS contained in <style> element inside <head> section Inline style. Using Style attribute inside html elements.
7th Jun 2019, 2:22 AM
Chris Coder
Chris Coder - avatar