Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

CSS Interview Questions and Answers

Test your skills through the online practice test: CSS Quiz Online Practice Test

Related differences

CSS 2 vs CSS 3

Ques 66. How do I eliminate the blue border around linked images?

in your CSS, you can specify the border property for linked images:

a img { border: none ; }
However, note that removing the border that indicates an image is a link makes it harder for users to distinguish quickly and easily which images on a web page are clickable.

Is it helpful? Add Comment View Comments
 

Ques 67. Why call the subtended angle a "pixel", instead of something else (e.g. "subangle")?

In most cases, a CSS pixel will be equal to a device pixel. But, as you point out, the definition of a CSS pixel will sometimes be different. For example, on a laser printer, one CSS pixel can be equal to 3x3 device pixels to avoid printing illegibly small text and images. I don't recall anyone ever proposing another name for it. Subangle? Personally, I think most people would prefer the pragmatic "px" to the non-intuitive "sa".

Is it helpful? Add Comment View Comments
 

Ques 68. Why was the decision made to make padding apply outside of the width of a 'box', rather than inside, which would seem to make more sense?

It makes sense in some situations, but not in others. For example, when a child element is set to width: 100%, I don't think it should cover the padding of its parent. The box-sizing property in CSS3 addresses this issue. Ideally, the issue should have been addressed earlier, though.

Is it helpful? Add Comment View Comments
 

Ques 69. How to use CSS to separate content and design ?


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 <link>-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!

Is it helpful? Add Comment View Comments
 

Ques 70. Some examples of good and bad coding. What?s wrong with this?


<font size="3">Welcome to my page</font>

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:
<h1>Welcome to my page</h1>

In the CSS:
h1 { font-size: 2em; }

One more example:

<b>An error occurred</b>

This looks right doesn?t it? But if you look up what <b> 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 <em> 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:
<em>An error occured</em>

In the CSS:
em {
font-weight: bold;
color: Red;
}

One last example:

<table>
<tr><td><a href="">first link</a></td></tr>
<tr><td><a href="">second link</a></td></tr>
...
</table>

Is it helpful? Add Comment View Comments
 
5) Some examples of good and bad coding. What?s wrong with this? " />

Most helpful rated by users:

©2024 WithoutBook