scandir
scandir

Reputation: 313

Vertical align text inside div

I know this question has been asked billion times, I searched a lot of solutions but none of them seem to work for me. So, I want to vertical center simple <h1> and two <h3> tags. Down below is a code and link to fiddle.

JSFiddle: http://jsfiddle.net/q38o6cxe/1/

Upvotes: 0

Views: 47

Answers (2)

Suresh Ponnukalai
Suresh Ponnukalai

Reputation: 13988

Add vertical-align:middle and display:table-cell for your parent tag.

  #jumbotron-second {
      background: url(../img/wallpaper.jpg);
      width: 100%;
      height: 800px;
      background-repeat: no-repeat;
      background-position: center;
      background-size: cover;
      display:table-cell;
      vertical-align:middle;
    }

DEMO

Upvotes: 2

letsjak
letsjak

Reputation: 359

        #jumbotron-second h1 {
          color: black;
          word-wrap: break-word;
          font-size: 60px;
          text-align:center; // added
        }
        #jumbotron-second h3 {
             color: black;
             text-align:center; // added
        }

do you mean something like this?

Upvotes: 1

Related Questions