nth-of-typeSelector

nth-of-typeSelector example

by Ananda Projapati

HTML

<div>
  <img src="https://pixabay.com/static/uploads/photo/2016/08/17/01/39/mystery-1599527_960_720.jpg" height="150px">
  <p>
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here,
    content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various
    versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
  </p>
  <img src="https://pixabay.com/static/uploads/photo/2016/08/17/01/39/mystery-1599527_960_720.jpg" height="150px">
  <p>
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here,
    content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various
    versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
  </p>
  <img src="https://pixabay.com/static/uploads/photo/2016/08/17/01/39/mystery-1599527_960_720.jpg" height="150px">
  <p>
    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here,
    content here', making it look like readable English. Many desktop publishing packages and web page...

CSS

img {
  float: left;
  margin-right: 15px;
}

div img:nth-of-type(3n) {
  border: 1px solid red;
}