Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Page width – cant get normally paddings

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #41025
    tanotify
    Member

    Hello and sorry. Question is really easy, but after reading your web site and book, i did not get answer for it. So..
    I want to make web site which have in psd file width – 1024 and left&right paddings – 38..
    But after a lot of trying i cant to make relative design, where in size of window (1024px) will be same paddings..

    My CSS:
    #page {
    width: 92,578125%; (948/1024)
    margin: 20px auto; – is it just editing top margin?)
    background: #ff00ff;
    }

    What i have-
    http://cl.ly/image/0p1u1H2Q250k

    Padding looks like-
    http://cl.ly/image/1U2Y47051M3z

    Sorry for my english and hope you understood what i meant ;)

    #115577
    Paulie_D
    Member

    Firstly, you should probably be using a reset or normalise css.

    For a width as specified for the ‘page’ you should have

    page {
    width:1024px
    padding:0 38px;
    }

    However, you should be aware that **normally** padding is ADDED to a specified width so the ACTUAL width will be 1100px.

    To get round this you have to use change the way this is done with

    * {
    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box; /* Firefox, other Gecko */
    box-sizing: border-box; /* Opera/IE 8+ */
    }

    #115579
    rautmahi
    Member

    I didn’t understand your issue correctly, but I believe, adding the float property may solve your issue. It will force layout to take padding or margin whatever you want to add.

    #115582
    Paulie_D
    Member

    You wouldn’t float a whole page!

    And in any case…I don’t think that’s his issue.

    Here’s an example of the difference: http://codepen.io/anon/pen/iFgmx

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.