-
AuthorPosts
-
December 20, 2022 at 3:24 pm #1376895
Hello!
I’m showing an icon list at the top of a website and I have 3 items in the list. Instead of showing 3 across (there’s room) it only shows 2 across and the 3rd item is in the 2nd row.
How do I get the icon list to show the 3 items in one row and only go to 2 rows if the size of the browser is too small?
December 21, 2022 at 8:00 am #1376959Hey JeffBianchi,
Thank you for the inquiry.
We can’t reproduce the issue on our end. Would you mind providing a screenshot? Please use imgur, savvyify or dropbox.
To display a list of items in a single row that only wraps to multiple rows if the size of the browser is too small, you’ll want to use a responsive layout. One way to do this is to use a flexbox layout, which allows you to control how items are laid out in a container.
Here’s an example of how you could use a flexbox layout to display your list of icons in a single row that wraps to multiple rows only if necessary:
1.) First, wrap your list of icons in a container element and give the container a class name (e.g. .av-custom-icon-list).
2.) Add the following CSS to your stylesheet:
.av-custom-icon-list { display: flex; flex-wrap: wrap; }
3.) This will make the container a flex container and allow its items to wrap to multiple rows if necessary.
If you want to set a maximum width for the container so that it wraps to multiple rows on smaller screens, you can add a media query to your CSS like this:
@media (max-width: 800px) { .av-custom-icon-list { max-width: 33%; } }
This will make the container wrap to multiple rows on screens that are 800px or smaller in width. You can adjust the value of 800px to set a different maximum width for the container.
4.) Finally, you can control the spacing between the icons by setting the margin property on the icon elements. For example:
.av-custom-icon-list .icon { margin: 0 10px; }
This will add a 10px margin to the right of each icon, creating space between the icons.
I hope this helps! Let me know if you have any questions or need further clarification.
Best regards,
IsmaelDecember 21, 2022 at 9:56 am #1376967Hi Ismael – that’s a strange notation of the code – are the line breaks coming from the board app? I know you know they are unnecessary – but where do they come from?
- This reply was modified 2 years ago by Guenni007.
December 21, 2022 at 3:20 pm #1376999Hi,
@guenni007: I mistakenly used Github markdown to wrap the css code, triple backticks, instead of just one. Fixed it.Best regards,
IsmaelDecember 21, 2022 at 3:22 pm #1377001Hi Ismael,
So will the code you provided work? Or does it need to change based on your last comment?
December 21, 2022 at 4:23 pm #1377011Hi Ismael,
I can’t get this to work. I’ve entered the css for #2 and #3 you mentioned above and I don’t see any difference.
December 22, 2022 at 11:46 am #1377089Hey!
Thank you for the update.
Did you apply the av-custom-icon-list class name to the element? The third item in the row doesn’t break into the second line when we checked the site on smaller screens. Would you mind providing a screenshot?
Regards,
IsmaelDecember 22, 2022 at 2:10 pm #1377113I’m sorry, yes I did css items #1, #2 & #3 that you mentioned above. I applied #1 to the section element that contains the row element in which the icon list exists. I’ve added a link to the website so you can see.
December 24, 2022 at 10:09 pm #1377312Hi,
Thanks for the link to your site, when I check I see this css:#top .horizontal-icon-list .avia-icon-list { display: grid; grid-template-columns: repeat(2,1fr); }
causing this layout:
Try this css instead:#top .horizontal-icon-list .avia-icon-list { display: grid; grid-template-columns: repeat(3,1fr); } #top.home #av_section_1 .flex_column.first.flex_column_div { padding: 0; }
Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.