FAQ: Learn CSS Selectors Visual Rules - CSS Setup Selectors - Inline Styles

This community-built FAQ covers the “Inline Styles” exercise in Codecademy’s CSS lessons.

FAQs on the CSS exercise Inline Styles

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about CSS in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

I heard that you best avoid inline styling, that working in css is prefferably the way for styling. Is this true and why?

I remember reading in the first HTML sections (or in their discussion boards) it’s called “separation of concerns” to keep the html, css, and JS separate from each other. Reasons were it’s easier to work on, as opposed to trying to locate everything in one huge document, and also it’s easier to style the page with css since you can style multiple elements at once, as opposed to coding in styling for each element in the html doc.

1 Like

must you include the ; after every attribute, even if that attribute is the last?
eg. <!p style=“font-family:Arial;”>

Only the last can be left off since it is followed by a string delimiter. That’s why they call the semi-colon a declaration separator. We only need it if there is another property following.

Most people just go with whatever habit they have formed, but then most people have resolved to avoid inline styles in production code for the maintenance issues they impose. For testing or for isolating they serve a purpose.

CSS is an in dependent language how does it works with html, is it browser magic?

Not magic, no. The browser has three principle APIs: HTML, CSS and ECMAScript. The DOM is constructed from the HTML and the rendering engine merges the CSS rules with their respective selectors. Script runs in the namespace and hooks element nodes by their id, class or tagname.