vendredi 26 janvier 2018

Float property does not work on and elements

In my website I have a paragraph and image inside a div. I am trying to float the image to the left and paragraph to the right. However, my code doesn't work.

.text {
  background-color: white;
  font: 400 15px/1.8 "Lato", sans-serif;
}

p {
  padding: 4em 4.5em;
  text-align: justify;
  color: #777;
}

.text2 {
  #display: inline-block;
}

.text2 p {
  float: right;
  width: auto;
  position: relative;
}

.text2 img {
  float: left;
  width: 20%;
  position: relative;
}
<div class="text text2">

  <h3 style="text-align:center">XİDMƏTLƏR</h3>

  <p>Parallax scrolling is a web site trend where the background content is moved at a different speed than the foreground content while scrolling. Nascetur per nec posuere turpis, lectus nec libero turpis nunc at, sed posuere mollis ullamcorper libero ante
    lectus, blandit pellentesque a, magna turpis est sapien duis blandit dignissim. Viverra interdum mi magna mi, morbi sociis. Condimentum dui ipsum consequat morbi, curabitur aliquam pede, nullam vitae eu placerat eget et vehicula. Varius quisque non
    molestie dolor, nunc nisl dapibus vestibulum at, sodales tincidunt mauris ullamcorper, dapibus pulvinar, in in neque risus odio. Accumsan fringilla vulputate at quibusdam sociis eleifend, aenean maecenas vulputate, non id vehicula lorem mattis, ratione
    interdum sociis ornare. Suscipit proin magna cras vel, non sit platea sit, maecenas ante augue etiam maecenas, porta porttitor placerat leo.</p>

  <img src="http://via.placeholder.com/640x426">
</div>



Aucun commentaire:

Enregistrer un commentaire