Hi my name is Steven and I'm new to the world of coding and i'm in the first lesson of HTML and Css. I'm on the lesson where it talks about inserting tags opening and closing tags. I want to know when writing code when you first start off with after the doctype tag if the tags would be separate lines or would they be included on the same line. i'm a bit confused. Can someone assist.
I read your post:
The Doctype usually is on the first tab.
When you say:
Do you mean writing the Doctype Html or just Html?
Browsers ignore white space in HTML, so technically all the HTML can be on one line. How would we read and edit it, though? It would be a nightmare.
A lot of websites compress HTML documents to save on bandwidth and download time. These are known as production pages and are never edited again. The developers still have the uncompressed version if they ever need to make changes.
For our purposes, use separate lines for each element so you can read and debug your page.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Basic HTML Setup</title> </head> <body> <div> <h1>Basic HTML Setup</h1> <p>This is a very basic HTML page.</p> </div> </body> </html>
Notice how the above syntax highlighting does not color the document type declaration? That is because it is not a selector. If it was, then we could style it. Notwithstanding we cannot style elements in the head, either.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.