1

I am facing a problem: HTML:

<div id="picture_buttons">
            <p class="images"></p>
            <p class="images"></p>
            <p class="images"></p>
            <p class="images"></p>
</div>

CSS:

#picture_buttons{
    width:74%;
    margin:20px auto 20px auto;
    overflow:auto;
    padding:2%;
    border:solid 1px white;
    text-align:center;
}
.images{
    width:34%;
    height:45%;
    float:left;
    display:inline-block;
    margin:6%;
    background-color:white;
}

Now I am facing two problems: First, I am not able to set the height of paragraphs in %. It just doesn't display anything, but if I specify the size in pixels, then there is no problem. Second, the text-align:center; property in "#picture_buttons" is not working as well.

Please help.

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
codetalker
  • 576
  • 1
  • 6
  • 21

1 Answers1

2

In terms of the percentage height, you need to specify the height of parent elements.

Try this:

html, body { height: 100%; }
#picture-buttons { height: 100%; }

For an explanation of how percentage height works, see my answer here:
Why is the 'height' property with percentage value not working on my div?

Community
  • 1
  • 1
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701