• +91 9723535972
  • info@interviewmaterial.com

CSS Interview Questions and Answers

Related Subjects

Question - How to use CSS to separate content and design ?

Answer - The idea here is that all sites contain two major parts, the content: all your articles, text and photos and the design: rounded corners, colors and effects. Usually those two are made in different parts of a webpage’s lifetime. The design is determined at the beginning and then you start filling it with content and keep the design fixed. In CSS you just add the nifty -tag I’ve told you about to the head of your HTML document and you have created a link to your design. In the HTML document you put content only, and that link of yours makes sure it looks right. You can also use the exact same link on many of your pages, giving them all of them the same design. You want to add content? Just write a plain HTML document and think about marking things up like “header” instead of “big blue header” and use CSS to make all headers look the way you want! Some examples of good and bad coding. What’s wrong with this? Welcome to my page Comment: The font-tag is design and design shouldn’t be in the HTML document. All design should be in the CSS-file! Instead do this: In the HTML:

Welcome to my page

In the CSS: h1 { font-size: 2em; } One more example: An error occurred This looks right doesn’t it? But if you look up what stands for you quickly find bold. But bold is certainly design, so it still doesn’t belong in the HTML document. A better choice is that stands for emphasis or simply “this piece of text is important”. So instead of saying “this text looks like this” you are saying “this text is important” and you let the looks be decided by the CSS. Seems like a minor change, but it illustrates how to select your tags. Use this instead: In the HTML: An error occured In the CSS: em { font-weight: bold; color: Red; } One last example:

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners