Vertical center content on a page

There’s actually many ways to center codes vertically, but this method is the most simple. Here’s all you need.

<style type="text/css" media="all">
html, body {height:100%; margin:0; padding:0; background:#000;}
#spacer {height:50%; margin-bottom:-200px; position:relative;} /* You must know the height of your content, divide by 2 for margin-bottom */
#content {clear:both; height:400px; width:500px; position:relative; margin:0 auto; background-color:#fff; text-align:center; color:#000;}
</style>

<body>
<div id="spacer"> </div>
<div id="content"> Your Content Here</div>
</body>

This creates a white box 500px by 400px, centered horizontally and vertically on the page.

Posted on February 15, 2012 in Web

Share the Story

About the Author

Responses (57)

  1. metronidazole 500mg for teeth
    March 18, 2021 at 3:05 pm ·

    metronidazole 500mg for teeth

    Vertical center content on a page – Eris Graphics

  2. generic viagra india
    March 19, 2021 at 3:00 am ·

    generic viagra india

    generic viagra india

  3. buying viagra
    March 19, 2021 at 6:58 am ·

    buying viagra

    buying viagra

  4. levitra 20mg
    March 19, 2021 at 7:56 am ·

    levitra 20mg

    levitra 20mg

  5. cialis in action
    March 19, 2021 at 10:40 am ·

    cialis in action

    cialis in action

  6. cialis cost per pill
    March 19, 2021 at 12:27 pm ·

    cialis cost per pill

    cialis cost per pill

  7. viagra falls
    March 19, 2021 at 4:36 pm ·

    viagra falls

    viagra falls

  8. what is female viagra
    March 19, 2021 at 6:57 pm ·

    what is female viagra

    what is female viagra

  9. does viagra work
    March 19, 2021 at 9:03 pm ·

    does viagra work

    does viagra work

  10. warnings for cialis
    March 19, 2021 at 11:12 pm ·

    warnings for cialis

    warnings for cialis

  11. free viagra
    March 20, 2021 at 1:37 am ·

    free viagra

    free viagra

  12. how to take sildenafil citrate
    March 26, 2021 at 3:48 pm ·

    how to take sildenafil citrate

    Vertical center content on a page – Eris Graphics

  13. how much does cialis cost at cvs

    how much does cialis cost at cvs

  14. pharmacy rx one viagra
    April 3, 2021 at 6:12 am ·

    pharmacy rx one viagra

    pharmacy rx one viagra

  15. milf teasing son viagra
    April 3, 2021 at 10:14 am ·

    milf teasing son viagra

    milf teasing son viagra

  16. shri durga generic viagra
    April 3, 2021 at 12:12 pm ·

    shri durga generic viagra

    shri durga generic viagra

  17. taking viagra with illigal drugs
    April 3, 2021 at 11:31 pm ·

    taking viagra with illigal drugs

    taking viagra with illigal drugs

  18. sildenafil for ed dosage
    April 4, 2021 at 1:22 am ·

    sildenafil for ed dosage

    sildenafil for ed dosage

  19. viagra sin receta y barato
    April 4, 2021 at 3:35 am ·

    viagra sin receta y barato

    viagra sin receta y barato

  20. discount cialis online
    April 4, 2021 at 6:19 am ·

    discount cialis online

    discount cialis online

  21. global pharmacy viagra
    April 4, 2021 at 12:43 pm ·

    global pharmacy viagra

    global pharmacy viagra

  22. cialis generic from mexico
    April 4, 2021 at 4:02 pm ·

    cialis generic from mexico

    cialis generic from mexico

  23. buy 150 mg viagra online
    April 5, 2021 at 4:39 am ·

    buy 150 mg viagra online

    buy 150 mg viagra online

  24. sildenafil prices 20 mg
    April 5, 2021 at 8:20 am ·

    sildenafil prices 20 mg

    sildenafil prices 20 mg

  25. combining cialis and otc ed pills

    combining cialis and otc ed pills

  26. cialis reviews reddit australia
    April 5, 2021 at 1:25 pm ·

    cialis reviews reddit australia

    cialis reviews reddit australia

  27. generic viagra 50 mg us
    April 5, 2021 at 2:51 pm ·

    generic viagra 50 mg us

    generic viagra 50 mg us

  28. moore stepmom viagra problem
    April 5, 2021 at 4:49 pm ·

    moore stepmom viagra problem

    moore stepmom viagra problem

  29. amoxicillin for pneumonia
    April 6, 2021 at 5:12 am ·

    amoxicillin for pneumonia

    amoxicillin for pneumonia

  30. does amoxicillin treat uti
    April 6, 2021 at 6:16 am ·

    does amoxicillin treat uti

    does amoxicillin treat uti

  31. azithromycin and sun exposure
    April 6, 2021 at 9:56 am ·

    azithromycin and sun exposure

    azithromycin and sun exposure

  32. celecoxib mechanisms of action
    April 6, 2021 at 1:26 pm ·

    celecoxib mechanisms of action

    celecoxib mechanisms of action

  33. celecoxib manufacturer
    April 6, 2021 at 4:40 pm ·

    celecoxib manufacturer

    celecoxib manufacturer

  34. cephalexin 500 mg capsule uses
    April 6, 2021 at 7:16 pm ·

    cephalexin 500 mg capsule uses

    cephalexin 500 mg capsule uses

  35. walmart keflex price
    April 6, 2021 at 8:32 pm ·

    walmart keflex price

    walmart keflex price

  36. alcohol cymbalta
    April 7, 2021 at 2:14 am ·

    alcohol cymbalta

    alcohol cymbalta

  37. hydroxychloroquine dosage for lupus

    Vertical center content on a page – Eris Graphics

  38. cialis online fast shipping
    April 22, 2021 at 12:11 pm ·

    cialis online fast shipping

    Vertical center content on a page – Eris Graphics

  39. where to get hydroxychloroquine
    April 24, 2021 at 2:46 am ·

    where to get hydroxychloroquine

    Vertical center content on a page – Eris Graphics

  40. where to buy hydroxychloroquine online

    Vertical center content on a page – Eris Graphics

  41. over counter antibiotics pills amoxicillin

    Vertical center content on a page – Eris Graphics

  42. best price for vidalista tablets

    Vertical center content on a page – Eris Graphics

  43. average cost cialis daily use

    Vertical center content on a page – Eris Graphics

  44. lovoo promo code 2018
    May 19, 2021 at 9:04 am ·

    lovoo promo code 2018

    Vertical center content on a page – Eris Graphics

  45. prescription cialis online
    May 20, 2021 at 2:18 pm ·

    prescription cialis online

    Vertical center content on a page – Eris Graphics

  46. when will careprost be available in generic

    Vertical center content on a page – Eris Graphics

  47. tetracycline powder for chickens

    Vertical center content on a page – Eris Graphics

  48. dapoxetine other uses
    May 26, 2021 at 5:53 am ·

    dapoxetine other uses

    Vertical center content on a page – Eris Graphics

  49. how to get cialis pills
    May 26, 2021 at 2:24 pm ·

    how to get cialis pills

    Vertical center content on a page – Eris Graphics

  50. hydroxychloroquine for malaria prevention

    Vertical center content on a page – Eris Graphics

  51. how long can you take azithromycin

    Vertical center content on a page – Eris Graphics

  52. albuterol solution for nebulizer prescription

    Vertical center content on a page – Eris Graphics

  53. malaria medicine side effects
    June 6, 2021 at 3:31 pm ·

    malaria medicine side effects

    Vertical center content on a page – Eris Graphics

  54. canadian pharcharmy online review

    Vertical center content on a page – Eris Graphics

  55. buy cialis 5mg daily use
    June 9, 2021 at 12:53 am ·

    buy cialis 5mg daily use

    Vertical center content on a page – Eris Graphics

  56. who owns hydroxychloroquine patent

    Vertical center content on a page – Eris Graphics

  57. can metronidazole cure yeast infection

    Vertical center content on a page – Eris Graphics

Leave a reply

Back to Top