List with display inline does not work properly

Asked

Viewed 128 times

1

I need to align in 3 columns my image and text help me please follow my code they are in a list

ul li {
  list-style-type: none;
}
.corpo-1 h1 {
  color: #000;
  text-align: center;
  font-family: Gabriola;
  font-size: 2.8em;
  font-weight: bold;
  margin-top: 40%;
}
.corpo-1 p {
  color: #000;
  text-align: center;
  font-family: Gabriola;
  font-size: 1.2em;
  margin-top: -2%;
}
.linha-titulo {
  width: 30%;
  height: 1.9px;
  border: none;
  background: #000;
}
.tamanho {
  -webkit-transform: scale(0.6);
  -o-transform: scale(0.6);
  -ms-transform: scale(0.6);
  -moz-transform: scale(0.6);
  transform: scale(0.6);
}
.info h1 {
  margin-top: -3%;
}
.info {
  text-align: center;
}
.info li {
  display: inline;
}
.info li img {}
<section class="corpo-1">
  <h1>Lorem ipsum dolor adipiscing<br />
            amet dolor consequat</h1>

  <p>Adipiscing a commodo ante nunc accumsan interdum mi ante adipiscing. A nunc lobortis non nisl amet vis volutpat aclacus nascetur ac non.
    <br/>Lorem curae eu ante amet sapien in tempus ac. Adipiscing id accumsan adipiscing ipsum.</p>

  <hr class="linha-titulo">
  <!-- <img src="images/logo-transp.png" /> -->
  <ul class="info">
    <li>
      <img src="http://ic.pics.livejournal.com/menami_sama/32531158/565942/565942_original.png" alt="" class="tamanho" />
      <h1>Lorem Ipsum Dolor</h1>
      <p>Lorem ipsum dolor sit amet, consectetuer elit.</p>
      <p>Vestibulum at purus sed erat suscipit.</p>
      <p>Cras facilisis viverra wisi. Class sociosqu...</p>
    </li>

    <li>
      <img src="http://ic.pics.livejournal.com/menami_sama/32531158/565942/565942_original.png" alt="" class="tamanho" />
      <h1>Lorem Ipsum Dolor</h1>
      <p>Lorem ipsum dolor sit amet, consectetuer elit.</p>
      <p>Vestibulum at purus sed erat suscipit.</p>
      <p>Cras facilisis viverra wisi. Class sociosqu...</p>
    </li>

    <li>
      <img src="http://ic.pics.livejournal.com/menami_sama/32531158/565942/565942_original.png" alt="" class="tamanho" />
      <h1>Lorem Ipsum Dolor</h1>
      <p>Lorem ipsum dolor sit amet, consectetuer elit.</p>
      <p>Vestibulum at purus sed erat suscipit.</p>
      <p>Cras facilisis viverra wisi. Class sociosqu...</p>
    </li>
  </ul>
</section>

they have to stay like this :

inserir a descrição da imagem aqui

here is the image of my button as it looked in the browsers after the edits:

on Google Chrome:

inserir a descrição da imagem aqui

On mozzarella:

inserir a descrição da imagem aqui

on Safari:

inserir a descrição da imagem aqui

and at the Opera:

inserir a descrição da imagem aqui

Follow the button code:

 <p class="text-center">    
      <a href="#">
         <button id="btn-info">leia mais ...</button>
     </a>
 </p>

#btn-info{
    border:3px solid #000;
    border-radius: 5px;
    width: 220px;
    height: 50px;
    text-align: center;
    font-family: Gabriola;
    font-size: 1.5em;
    color: #000;
    background: transparent;
    cursor: pointer;
    margin-top: 5%;
    clear: both;

}

#btn-info:hover{
    background: #000;
    color: #fff;
}

3 answers

1

To stand side by side you can set:

ul li {
  list-style-type:none;
  float:left;
}

Still it would not have a result as you wish, as they would not be centralized, but then just set a width for your ul and center it:

ul { 
  width:72%;
  margin:auto;
}

It may not be "best practice," but it works! D

1


  • friend ultilized his method and it worked well but just below my list goes a button that is in the center only that it gets straight google Hrome and opera already in mozila and safari not because it is aligned to the left of my list knows what happened

  • How is the code for that button? (html and css)

  • I’ll edit the post for you to see and put the image of how it looked in the browsers

  • Ready edited friend if he can understand how you can see in the image only in Hrome and in opera the boot was the right way

  • The button is inside the Section?

  • This gets inside of it just above the </Section tag>

  • Brother, pq put <button></button> inside the tag <a href=""></a>?

  • Vaccination and custom rsrsrs I have just removed however the situation has not changed at all

  • 1

    Ok, you will use the <a> or the <button> ?

  • I’ll use the button q it will redirect me to another page

  • I edited my answer, go to Jsfiddle

  • you and fuck face vlw even

  • Valew brother, luck in the projects!

Show 8 more comments

0

ul{
     display: flex;
     flex-direction: row;
     flex-wrap: wrap;
     justify-content: center;
     align-items: center;
 }
ul li {
  list-style-type: none;
}
.corpo-1 h1 {
  color: #000;
  text-align: center;
  font-family: Gabriola;
  font-size: 2.8em;
  font-weight: bold;
  margin-top: 40%;
}
.corpo-1 p {
  color: #000;
  text-align: center;
  font-family: Gabriola;
  font-size: 1.2em;
  margin-top: -2%;
}
.linha-titulo {
  width: 30%;
  height: 1.9px;
  border: none;
  background: #000;
}
.tamanho {
  -webkit-transform: scale(0.6);
  -o-transform: scale(0.6);
  -ms-transform: scale(0.6);
  -moz-transform: scale(0.6);
  transform: scale(0.6);
}
.info h1 {
  margin-top: -3%;
}
.info {
  text-align: center;
}
.info li {
  display: inline;
}
.info li img {}
<section class="corpo-1">
  <h1>Lorem ipsum dolor adipiscing<br />
            amet dolor consequat</h1>

  <p>Adipiscing a commodo ante nunc accumsan interdum mi ante adipiscing. A nunc lobortis non nisl amet vis volutpat aclacus nascetur ac non.
    <br/>Lorem curae eu ante amet sapien in tempus ac. Adipiscing id accumsan adipiscing ipsum.</p>

  <hr class="linha-titulo">
  <!-- <img src="images/logo-transp.png" /> -->
  <ul class="info">
    <li>
      <img src="http://ic.pics.livejournal.com/menami_sama/32531158/565942/565942_original.png" alt="" class="tamanho" />
      <h1>Lorem Ipsum Dolor</h1>
      <p>Lorem ipsum dolor sit amet, consectetuer elit.</p>
      <p>Vestibulum at purus sed erat suscipit.</p>
      <p>Cras facilisis viverra wisi. Class sociosqu...</p>
    </li>

    <li>
      <img src="http://ic.pics.livejournal.com/menami_sama/32531158/565942/565942_original.png" alt="" class="tamanho" />
      <h1>Lorem Ipsum Dolor</h1>
      <p>Lorem ipsum dolor sit amet, consectetuer elit.</p>
      <p>Vestibulum at purus sed erat suscipit.</p>
      <p>Cras facilisis viverra wisi. Class sociosqu...</p>
    </li>

    <li>
      <img src="http://ic.pics.livejournal.com/menami_sama/32531158/565942/565942_original.png" alt="" class="tamanho" />
      <h1>Lorem Ipsum Dolor</h1>
      <p>Lorem ipsum dolor sit amet, consectetuer elit.</p>
      <p>Vestibulum at purus sed erat suscipit.</p>
      <p>Cras facilisis viverra wisi. Class sociosqu...</p>
    </li>
  </ul>
</section>

  • I just said that UL should center its LI’s. Missing say display would have UL. ul{ display: flex; flex-Direction: Row; flex-wrap: wrap; Justify-content: center; align-items: center; }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.