Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2008
    India, Banglore
    Thanked 0 Times in 0 Posts

    when and where to use these in css?

    1) when do we use line-height and height? (In menus (ul,li) do we use height or line-height?)
    2) when do we use % and pixel?
    3) when do we use
    ? are they supportive for IE?
    4) when do we use float and clear function?
    5) Using use tables when div's are not aligned properly is right method?

    These all problems I face in my current project, Please clarify me with this so that its very helpful to align my work..

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Halle (Saale), Germany
    Thanked 1,315 Times in 1,285 Posts
    The line-height property is for the height of a line (how ironic), usually this applies to text. The lines of the text will be spaced out vertically if you increase the line height (i. e. the lines become higher) while the height property specifies the height of an element (it’s a difference if you increase the height of the lines in a paragraph or the height of the paragraph itself).

    For lists I would suggest using height, perhaps together with some top and bottom padding for the list items (or perhaps scrap the fixed height and just apply some top and bottom padding). Line height can be useful as well but might become problematic with cross browser compatibility or if the text in the list items wraps.

    If you use percents or pixels as values is completely your choice. If you want a liquid layout (adapting to the size of the viewport) or a layout that keeps the dimensions relative to the size of the viewport you should use relative units such as percent, em, or ex. If your layout is static you should use absolute units such as px (pixels), cm (centimeters), in (inch), mm (millimeters), pt (points), or pc (picas). These latter ones are probably more useful for print layouts so the px unit would be the most appropriate for screen layouts. Also refer to http://www.w3schools.com/css/css_units.asp Note that you can mix any of the units. For example you can specify your general page width in pixels and then specify widths of child elements in percents which relate to the width of the parent.

    I don’t have the time to explain the other stuff right now as it’s a little more involved.

  3. Users who have thanked VIPStephan for this post:

    ksanjanadevi (05-12-2009)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts