Site logo

Archived topic

Is it possible to flex-shrink the social icons?

12 replies · Started by Onur on October 10, 2021

Viewing posts 1–13 of 13

Hi,

I am using Tom's plugin for social icons on my blog. I wanted to make them responsive for mobile. They were overflowing the widget container. For this, I applied flex-wrap: wrap; option and it worked well but it created some CLS issues. Is it possible to use the flex-shrink option to shrink the social icons when the browser getting smaller?

The custom CSS which I was using:

.lsi-social-icons{
	  min-height: 50px !important;
}

.lsi-social-icons.icon-set-lsi_widget-2{
	  display: flex !important;
	  flex-wrap: wrap !important;
	  justify-content: center !important;
}

Hi Onur,

any particular reason for the need for flex-shrink property?

If it's a to keep the icons in 1 row, I don't think flex-shrink alone would solve the issue because the icon size has a fixed size.

Can you explain a bit more on the desired behavior/styling?

Hi Elvin,

I just want to keep the social icons in one row inside the widget container. Any solution will be OK for me. I tried wrap but because of wrapping, it created some CLS problems and I reverted that option.

Thanks.

I just want to keep the social icons in one row inside the widget container. Any solution will be OK for me. I tried wrap but because of wrapping, it created some CLS problems and I reverted that option.

Consider these things:

Try reducing the padding first:

.lsi-social-icons li a {
    padding: 3px;
}

Also, try reducing the font icon size as well. You can set that on Appearance > Widgets.

I believe you have set it to 20px. Try using 16px or smaller.

as for flex shrink, you can do it with this CSS:

.lsi-social-icons li {
    flex: 0 1 auto;
}

But I don't think this will make a difference. LSI uses font icons instead of SVG. It's a pretty old plugin.

Before doing these and using the LSI plugin, do you suggest any other thing to show the social sites to the users? One other problem is my sidebars are loading later than the actual content for short content pages and because of that when I activated the WP Rocket's unused CSS option, I am having CLS problems.

If you have a better solution rather than the LSI plugin, I will be so much happy to hear. LSI is a very minimal plugin that I cannot also do too many variations on it.

Thanks,
Onur

Hi Ying I did what you suggested and it worked awesomely! Thanks a lot.

I have one more question.

How can I make the search bar and search icon "horizontally fit the container" like the social buttons? Currently, the social icons based on Generate Blocks buttons are responsive and horizontally fitting. I want to make the search bar and the search icon similar.

Sample link: Rest Assured Tutorial

Give this CSS a try:

.widget_search .search-form {
    flex-wrap: wrap;
}
aside#search-8 .search-form > label {
    flex: 5 1 0;
    min-width: 100px;
}
aside#search-8 .search-form > button {
    flex: 1 1 0;
}

Feel free to change the min-width of the search field, it's the width that the button goes down to another row.

Let me know how it works :)

Yeap! It worked perfectly! Thanks a lot, Ying! :)

Sending a message to make the post as resolved.

You are welcome Onur :)

This archived topic is closed to new replies.