Pages

Jun 21, 2011

CSS/HTML Interview Questions

CSS/HTML Interview Questions


1. What CSS means? In addition, how it works?
CSS:
How it works:








2. Which of them should work and which of them do not work to center an object horizontally (also implement the theoretical concept), explain?
(Put cross or right, left side and explain it right side)
a) Take a wrapper and style it to {margin: 0 auto; }. Explain:


b) #DIV {top: center; left:center; }. Explain:


c) #DIV {top: 50%; left:50%; right: -200px; bottom: -250px; height:500px ;weight:400}. Explain:




d) #DIV {top: 50%; left:50% }. Explain:




e) Take a wrapper and style it to {text-align:center;}. Explain:




3. How to align an object to vertically center?


4. How overlap a Flash Object?






5. How to create CSS Menu (one item would be enough)? Give an Example with HTML + CSS.




6. What do you understand by the term of selectors? Give some example.


7. How many types of styles sheets are there?




8. What do you know about Reset CSS?


9. Suppose you have an ID named “id”, class named “class”, h1 and h2 tags; now write a simple css rule for all of them at the same time.








10. What is the default CSS position for every object and the inherit does work?


11. Why specification is need in CSS Terms?


12. How to use a transparent image?






13. What float does? And What does ‘Clear’ have to do with it, explain.












14. Which cannot be negative? Which one does the outer spacing?


15. What CSS fixed position means?


16. What z-index does?


17. Write some CSS pseudo codes? And give some example of it.




18. Is CSS case sensitive?
a) Yes
b) No
19. How to use a Fixed and Repeated background using CSS?










20. What inline,block,none attribute does in the display parameter ?
Inline:
Block:
None:
21. What do you understand by the term of XHTML and HTML?
XHTML:
HTML:

CSS Center or Centering an Object

CSS Center or Centering an Object

How do you center a containing block on a page using CSS? There are two main methods and the choice should be made based on whether your page layout is liquid (will move in and out depending on the size of the browser window) or fixed width.

Centering liquid layouts

Liquid layouts are easy to center using margins on each side of the containing box. The margins can be set with em, pixel or percentage units.
div#container
{
 margin-left: 10%;
 margin-right: 10%;
}

Centering fixed-width layouts

Theoretically, you should be able to apply auto margins to the left and right of the containing block and it should center on the page.
The W3C Visual formatting model states: “If both ‘margin-left’ and ‘margin-right’ are ‘auto’, their used values are equal. This horizontally centers the element with respect to the edges of the containing block.”
So, a containing block should be able to be centered using the following rules:
div#container
{
 margin-left: auto;
 margin-right: auto;
 width: 50em;
}
However, some browsers do not center the containing blocks using this method as they ignore the auto margins. These browsers include:
  • NN4 (Mac and Win)
  • Win/IE4
  • Win/IE5
  • Win/IE5.5
  • Win/IE6 (when in quirks-mode)
By adding two simple rules, this problem can be overcome in all of the browsers mentioned above, excluding NN4.

1. Center the body

While these browsers ignore auto margins, they will follow “text-align: center”. If this is applied to the body, the containing block will center correctly. So, a new rule is added:
body
{
 text-align: center;
}

div#container
{
 margin-left: auto;
 margin-right: auto;
 width: 50em;
}

2. Resetting text-align

The only problem with this new rule is that all content on the page is now center-aligned. To overcome the center alignment problem, a new declaration is added within the containing block rule set – “text-align: left”. The final CSS code is:
body
{
 text-align: center;
}

div#container
{
 margin-left: auto;
 margin-right: auto;
 width: 50em;
 text-align: left;
}

Jun 4, 2011

Alim Ul Karim's Blog: Database First Approach / DB First Approach / MVC3

Alim Ul Karim's Blog: How to Create Database First in ASP.NET MVC3/MVC 3...: "If you are new in ASP . NET MVC / MVC3 or in EntityFramework ( EF ) you should look for some articles before read this topic. If you ar..."

Alim Ul Karim's Blog: Database First Approach / DB First Approach / MVC3