2

CSS:

body {
    background-color: #bad455;
}

.basic {
    background-color: blue;
    color: white;
    line-height: 30px;

    top: 0px;
    left: 0px;
    height: 50%;
    width: 150px;
    position: absolute;
    border: 8px solid red;
}

.container {
}

.basic > p {
    top: 50%;
    position: relative;
}   

HTML:

<body>
    <div class="container">
        <div class="basic">
            <p>This text should move</p>
        </div>
    </div>
    <!-- Further code... -->
</body>

Sorry but a stupid question. I'm not sure why this text doesn't go down 50% inside this div? I've been trying to use vertical-align, padding-top, text-center to 50%, but they didn't work that well and it always goes more than 50%. So is there any way to push this text inside to the center? Maybe its a position problem or something? I've been trying to solve this for quite a while but can't figure it out. Thanks in advance.

Ed The ''Pro''
  • 875
  • 10
  • 22
Edgaras
  • 69
  • 4

0 Answers0