How to center images/paragraphs/buttons

This question already has an answer here:

  • How to vertically center a div for all browsers? 41 answers

  • It's not good idea to center entire page vertically. You don't never know what device (resolution) does viewer use. If you aren't doing apps like Google spreadsheets, the page must stay vertically expandable because width of content is dependent on device/browser.


    i was trying your code and you can do this, as simple it seems,

    <div id="block1">
        <p class="name">Portfolio</p>
        <p class="title"> IT / BUSINESS / WEB</p>
        <p class="title">
        <button class="cv">Download CV</button>
        </p>    
    </div>
    
    <div id="block2">
        <p class="title">block 2</p>
    </div>
    
    <div id="block3">
        <p class="name">block 3</p>
    </div>
    

    i only added a "p" area but inside it is your botton try it and it works, and for the others you can duplicate this

    you can create a new style for the other tittles, follow the logic that you have already and change the color, or the size of your titles, standarize your development, is a good way to begin, i hope i helped you!!


    To center button somewhere use:

    HTML:

    <div id="center">
        <button>button1</button>
    </div>
    

    CSS:

    #center {
        background-color: red;
        text-align: center;
    }
    

    http://jsfiddle.net/Oposyma/82V8Y/5/

    链接地址: http://www.djcxy.com/p/41504.html

    上一篇: 如何在绝对定位的div上垂直对齐文本

    下一篇: 如何将图像/段落/按钮居中