Reputation: 13
I have 9 images in a flex display, when they are not wrapped in <a> tags, they look good.
However, I wanna make these images as clickable. So I wrapped them in <a> tags, however, the format changed to this:
The code is:
<div class="nine-products-section">
<button class="pre-btn">
<img src="{{media url="wysiwyg/Round-face-test/arrow.png"}}" alt="">
</button>
<button class="nxt-btn">
<img src="{{media url="wysiwyg/Round-face-test/arrow.png"}}" alt="">
</button>
<div class="product-container">
<a
href="xxxx"
rel="noopener"
class="product-link"
><img src="{{media
url="wysiwyg/Round-face-test/Ana_Product_Block_3x_622x233.jpg"}}" alt=""
class="product-image">
</a>
<a
href="xxxx"
rel="noopener class="
product-link=""
><img src="{{media
url="wysiwyg/Round-face-test/Logan_Product_Block_3x_622x233.jpg"}}" alt=""
class="product-image"></a
>
<a
href="xxxx"
rel="noopener"
class="product-link"
><img src="{{media
url="wysiwyg/Round-face-test/Hugh_Product_Block_3x_622x233.jpg"}}" alt=""
class="product-image">
</a>
<a
href="xxxx"
rel="noopener"
class="product-link"
><img src="{{media
url="wysiwyg/Round-face-test/Miles_Product_Block_3x_622x233.jpg"}}" alt=""
class="product-image">
</a>
<a
href="xxxx"
rel="noopener"
class="product-link"
><img src="{{media
url="wysiwyg/Round-face-test/Rae_Product_Block_3x_622x233.jpg"}}" alt=""
class="product-image"></a
>
<a
href="xxxx"
rel="noopener"
class="product-link"
><img src="{{media
url="wysiwyg/Round-face-test/Stella_Product_Block_3x_622x233.jpg"}}"
alt="" class="product-image">
</a>
<a
href="xxxx"
rel="noopener"
class="product-link"
><img src="{{media
url="wysiwyg/Round-face-test/Peggy_Product_Block_3x_622x233.jpg"}}" alt=""
class="product-image"></a
>
<a
href="xxxx"
rel="noopener"
class="product-link"
>
<img src="{{media
url="wysiwyg/Round-face-test/Serge2_Product_Block_3x_622x233.jpg"}}"
alt="" class="product-image">
</a>
<a
href="xxxx"
rel="noopener"
class="product-link"
><img src="{{media
url="wysiwyg/Round-face-test/Wilder_Product_Block_3x_622x233.jpg"}}"
alt="" class="product-image"></a
>
</div>
</div>
css:
.nine-products-section {
position: relative;
padding: 20px;
display: flex;
overflow-x: scroll;
}
.product-container {
display: flex;
overflow-x: auto;
scroll-behavior: smooth;
}
.product-image {
width: 80%;
display: flex;
margin: 0 auto;
}
I tried to style the <a> tag, height/ padding/ width. but they all did not work. How can I make these images keep the old style but clickable to redirect to the links?
Upvotes: 0
Views: 46
Reputation: 13
I got it fixed by adding:
a {
display: contents;
}
in the css file.
Upvotes: 1
Reputation: 1
Upvotes: 0