• +91 9723535972
  • info@interviewmaterial.com

CSS Interview Questions and Answers

Related Subjects

Question - Why are there gaps above and below my form in IE?

Answer - A lot of the time, when you find gaps that you can't account for, they are due the default styles of different browsers - especially the margins and padding. IE gives forms some margins above and below forms while Firefox doesn't. It's like with lists - you'll find bigger padding and margins for lists in IE than in Firefox. Paragraph margins are different, as are the margins on heading tags (h1,h2, etc). A good way to not get caught out by these problems is to set all margins and padding to zero at the top of your style sheet and then add them as and when you feel the a need for them, in that way, any margins and padding will be the same in different browsers. CSS * { margin:0; padding:0; } If one were to set Text and Link colors using a style sheet, should one also define the background colors for these elements as well? It is generally true that you should give background or background-color a value, but not necessarily a color value. E.g., if the document has a background image, you would "highlight" all links if you give them a background color. body { background-image: url(light-texture.png) #FFF; color: #000 } a:link, a:visited, a:active { color: #00F; background-color: transparent; } By setting the background-image explicitly to transparent, you lower the risk of another rule in the cascade giving links a background that would highlight them.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners