How to align text with the center of the div with Materialize?

I own a div with a text and an image:

div without detachment div with highlighted area in blue

This div has a block of text that must be aligned with the center. To do the alignment, I used the Class .valign-wrapper, which worked perfectly with the image. However, when applying the class, it only has an effect on the image, ignoring the paragraph attached to the side.

How can I align this block of text?

Structure of Sun

<div class="valign-wrapper">
  <div class="col s12 l6">
      <div class="col s12 l5 center-align">
        <p><img class="responsive-img circle" src="http://lorempixel.com/200/200/" alt="avatar"/></p>
      </div>
      <div class="col s12 l7 center-align valign-wrapper">
        <p class="user">
          <span>
            <small class="message">Bem vindo,</small><br/> <strong id="user-name">Fulano da Silva</strong>
          </span> <br/>
          <span class="phone">(51) 9 9999 - 9999 </span><br/>
          <span class="mail">[email protected]</span>
        </p>
      </div>
    </div>
</div>

CSS used

.avatar p.user{
  color: #455a64;
  line-height: 102%;
  margin-left: 0.2em;
}

span.phone, span.mail, small.message{
  font-size: 12px;
  word-wrap: break-word;
}

strong#user-name{
  font-size: 16px;
}

.avatar img{
  width: auto;
  max-width: 7em;
  height: auto;
}
Author: Arthur Siqueira, 2019-11-29

1 answers

Guy basically vc is using the class in the wrong div, and Class valign-wrapper is that

insert the description of the image here

I.e. is a container flex, with align-items: center. But only the direct children of this container will line up in the center, and you put the class in grandma

insert the description of the image here

See that correcting this all aligns

insert the description of the image here

Image code above

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Page Title</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

  <!-- Compiled and minified JavaScript -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
  
  .avatar p.user{
  color: #455a64;
  line-height: 102%;
  margin-left: 0.2em;
}

span.phone, span.mail, small.message{
  font-size: 12px;
  word-wrap: break-word;
}

strong#user-name{
  font-size: 16px;
}

.avatar img{
  width: auto;
  max-width: 7em;
  height: auto;
}
  
</style>
</head>
<body>
    <div class="row">

        <div class="col s6">

            <div class="valign-wrapper">
                <div class="col s12 l6 valign-wrapper">
                    <div class="col s12 l5 center-align">
                      <p><img class="responsive-img circle" src="http://lorempixel.com/200/200/" alt="avatar"/></p>
                    </div>
                    <div class="col s12 l7 center-align valign-wrapper">
                      <p class="user">
                        <span>
                          <small class="message">Bem vindo,</small><br/> <strong id="user-name">Fulano da Silva</strong>
                        </span> <br/>
                        <span class="phone">(51) 9 9999 - 9999 </span><br/>
                        <span class="mail">[email protected]</span>
                      </p>
                    </div>
                  </div>
              </div>
        </div>
        <div class="col s6">6-columns (one-half)</div>
      </div>

  
  <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
  <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script> -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>
 1
Author: hugocsl, 2019-11-29 19:28:07