1

I want to align all divs inside in a div next to each other and no other div of HTML has any effect on it

<div id="wrapper">
  <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
    </div>
    <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
    </div>
    <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
    </div><div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
    </div><div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
    </div>
    </div>

my problem is that I can no assign id/class to inside div and if I try

div{
   float:left;
}

it affect every div of that HTML I want to only align item next to each other wrapper id's divs and idea and suggestion will be appreciated

Shreyash mishra
  • 738
  • 1
  • 7
  • 30

1 Answers1

0

You can make the wrapper a flexbox using display: flex

#wrapper {
  display: flex
}
<div id="wrapper">
  <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
  </div>
  <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
  </div>
  <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
  </div>
  <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
  </div>
  <div>
    <img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg" width='50px'>
  </div>
</div>
kush
  • 154
  • 1
  • 12