HTML Element Style How to - Display images in a row








Question

We would like to know how to display images in a row.

Answer


<!DOCTYPE html>
<html>
<head>
<style>
ul {<!--from  w  ww.ja  v  a  2 s . com-->
  white-space: nowrap;
}

ul, li {
  list-style: none;
  display: inline;
}
</style>
</head>
<body>
  <ul>
    <li><img src="http://www.java2s.com/style/download.png"></li>
    <li><img src="http://www.java2s.com/style/download.png"></li>
    <li><img src="http://www.java2s.com/style/download.png"></li>
    <li><img src="http://www.java2s.com/style/download.png"></li>
    <li><img src="http://www.java2s.com/style/download.png"></li>
    <li><img src="http://www.java2s.com/style/download.png"></li>
  </ul>
</body>
</html>

The code above is rendered as follows: