Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialrenier dimarucot
413 PointsWhy is style before heading? It make more sense that the order is heading then style of that heading.
In other programming languages, an object is initiated first then it can be manipulated with things like properties. I assume there is no order then. I'm just curious why is this because order seems to make things easier.
1 Answer
Robert Richey
Courses Plus Student 16,352 PointsHi renier,
When the browser loads a Web page, it happens once, from top to bottom. For an element to appear styled, the browser needs to already understand what style(s) to apply to the element it is about to display. A Web page will often be written with this flow in mind:
- Load CSS styles in the head of the document
- Parse / Render HTML
- Load and Execute JavaScript
<html>
<head>
<!-- Load CSS here -->
</head>
<body>
<!-- Enter HTML content here -->
<!-- Load JavaScript before the closing body tag -->
</body>
</html>
Cheers
renier dimarucot
413 Pointsrenier dimarucot
413 PointsThe way you explain it, it makes so much sense. I am satisfied with this answer. Thank you for the quick reply.