简体   繁体   中英

Make responsive css box with text in it

I have three css boxes with text in it. But the height of the css textbox is fixed: height:800px;

But not every css text box has the same text. So one css text box has not so much text. But then you will see a lot of white space.

So my question is:

How to make a responsive css box?

Thank you

This is the css:

.box h5{
    text-align:center;
    position:relative;
    top:10px;
}
.box {
    width:100%;
    height:10px;
    background:#FFF;
    margin:40px auto;
}

/*==================================================
 * Effect 3
 * ===============================================*/
.effect3
{
  position: relative;
}
.effect3:before
{
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%;
  top: 80%;
  max-width:300px;
  background: #777;
  box-shadow: 0 15px 10px #777;
  transform: rotate(-3deg);
}



.box h5{
    text-align:left;
    margin:10px;
    position:relative;
    top:10px;
}
.box {
    width:100%;
    height:800px;
    background:#FFF;
    margin:40px auto;
}

/*==================================================
 * Effect 6
 * ===============================================*/
.effect6
{
    position:relative;       
        box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
}
.effect6:before, .effect6:after
{
    content:"";
    position:absolute; 
    z-index:-1;
    box-shadow:0 0 20px rgba(0,0,0,0.8);
    top:50%;
    bottom:0;
    left:10px;
    right:10px;
    border-radius:100px / 10px;
}

I try it with auto, but then I get a little bit overlap of text at the bottom of the css box

I solved like this:

.box h5 {
    text-align: left;
    margin: 10px;
    position: relative;
    top: 10px;
    padding-bottom: 15px;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM