How can get around this issue in my image gallery?

二次信任 提交于 2019-12-12 04:44:40

问题


This is how I have my HTML for the images in my gallery:

<p class="crop">
<img src="image1.jpg" alt="image1.jpg" /></p>
<p class="crop">
<img src="image2.jpg" alt="image2.jpg" /></p>

However, using p classes like this makes them separate images instead of a group of images and therefore my next/previous arrows don't work.

I need to make them a group of images so the arrows in the gallery can work again properly, but I want to keep the p class as I need it to crop the images. How can I get around this?


回答1:


Replace the p with 1 div so it would look like:

<div class="crop">
<img>
<img>
</div>

Add more images as needed (filling in the image data)

In the CSS you can then use:

.crop img {}

to crop the images!

Hope this helps :)




回答2:


Move the crop logic to the img tag

<img class="crop" src="image1.jpg" alt="image1.jpg" />
<img class="crop" src="image2.jpg" alt="image2.jpg" />


来源:https://stackoverflow.com/questions/13556537/how-can-get-around-this-issue-in-my-image-gallery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!