How can hbuilder align images in a row?

To line up the images, you can use the flex layout or grid layout in HBuilder.

Steps to use flex layout are as follows:

  1. show
  2. bend
  3. the direction in which elements are arranged in a flexible layout
  4. line
  5. Could you please provide a picture?
  6. A division or section of a webpage containing content.
  7. increase in size

The example code is provided below:

<!DOCTYPE html>
<html>
<head>
<style>
.container {
  display: flex;
  flex-direction: row;
}

img {
  flex-grow: 1;
}
</style>
</head>
<body>

<div class="container">
  <img src="image1.jpg">
  <img src="image2.jpg">
  <img src="image3.jpg">
</div>

</body>
</html>

The steps for using grid layout are as follows:

  1. show
  2. A network of intersecting horizontal and vertical lines.
  3. Can you provide a picture?
  4. The following content is enclosed within a
    element.
  5. layout columns

Here is an example code:

<!DOCTYPE html>
<html>
<head>
<style>
.container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr; /* 三列等宽 */
}

img {
  width: 100%;
}
</style>
</head>
<body>

<div class="container">
  <img src="image1.jpg">
  <img src="image2.jpg">
  <img src="image3.jpg">
</div>

</body>
</html>

These are two common methods, choose the layout that best suits your specific needs.

bannerAds