dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Responsive layouts and em or px?

  1. #1
    Join Date
    Sep 2005
    Posts
    1,636

    Responsive layouts and em or px?

    I'm testing http://twitter.github.io/bootstrap/

    and need to know how is influenced em or px inside this framework.

    Example:
    px for top and bottem and % for left and right. Meaning the width is adjustable and the height will be a fixed height...
    This is just example as responsive design is different:
    Generally, don't use px for responsive layouts, I guess.

    Solution:
    I will use percent on the body element (body { font-size: 62.5% or 100%; }), and then use the em unit to size it from there.

    1. What will be than other units like
    padding_/margin/border size/line-height...

    2. Can I use em for fonts size and padding/margin with px or it is not correct way to set layout and I have to use all the time em for font size and also for padding_/margin/border size/line-height...

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,143
    1. The padding/margin/etc will depend on the font size of the element your applying it to. For example, if you have:

    p {font-size: 1.2em; padding: 1em;} // the padding would be 12px

    2. Yes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles