Mastering Divi: Automatically Adjust Gallery Columns for Any Screen Size

by | Jun 12, 2024 | Divi Theme, Web Design, Wordpress

Mastering Divi: Automatically Adjust Gallery Columns for Any Screen Size

How to Customize Gallery Columns in Divi for Every Device

Hey everyone, Jamie here from System22 and! We recently received a fantastic question on one of our previous videos about creating a gallery with the Divi theme. Someone asked how to change the column structure of the Divi gallery module, as the default settings don’t allow for this customization on different devices. Today, I’m going to show you how to adjust the number of gallery columns to suit any screen size, making your sections unique and visually appealing across desktops, tablets, and mobiles.

In this tutorial, we’ll take a standard Divi gallery with around 20 images and transform it to have different column structures for various devices. By default, Divi sets the column structure automatically, which might not always suit your design needs. For instance, on an iPhone, you might only see one column, but perhaps you’d prefer two. On an iPad, you might see three columns, but maybe four would look better. We’ll use custom CSS to easily achieve this. Don’t worry if you’re new to CSS – Divi makes it straightforward with its dedicated CSS input fields. I’ll guide you step-by-step through the process of modifying the gallery columns for each device type, ensuring a responsive and personalized design.

### Setting Up Your Gallery

First, enable the Visual Builder in Divi and add a Gallery module to your page. Populate the gallery with your chosen images; for this example, I’ve included 24 images. In the Gallery module settings, you can adjust various options such as the layout, the image title, and the caption display. For my design, I opted to hide the title and caption because I want a clean, magazine-style layout where images are butted up against each other. However, if you prefer to display the title and caption, you can easily customize that within the module settings.

### Customizing Column Structure with CSS

Now, let’s dive into the customization. Navigate to the Advanced tab within the Gallery module settings, where we’ll be using a bit of custom CSS. Don’t let the idea of using CSS intimidate you; it’s quite simple, especially with Divi’s user-friendly interface that allows you to add CSS directly in the module settings.

1. **Open the Custom CSS Tab**: In the Advanced tab, locate the Custom CSS section. Divi provides specific fields where you can input your CSS, making it easier to manage and apply styles.

2. **Define Column Width**: To create a grid with a specific number of columns, you’ll need to calculate the width percentage. For instance, to create eight columns, you would divide 100% by 8, resulting in 12.5%. Enter the following CSS in the Gallery Item field:

width: 12.5% !important;

The `!important` declaration ensures that your custom style overrides any default styles set by Divi.

3. **Clear Floats and Margins**: Next, clear any default floats and margins to ensure a clean layout. Add the following lines to the Gallery Item field:

clear: none;
margin: 0;

This will remove any unwanted spacing and align the gallery items perfectly.

4. **Adjust for Responsive Design**: Now that we’ve set up the desktop view, it’s time to customize the column structure for tablets and mobile devices. Divi makes this easy with its responsive settings. Hover over the Custom CSS code you’ve entered, and you’ll see a mobile icon appear. Click on this icon to access the responsive settings.

### Customizing for Tablets and Mobiles

1. **Tablet View**: For the tablet view, you might want fewer columns to ensure the images are large enough to be appreciated. For example, setting four columns might be ideal. Enter the following CSS in the tablet view:

width: 25% !important;

This sets the column width to 25%, creating four columns (100% divided by 4).

2. **Mobile View**: For mobile devices, you might want even fewer columns to ensure the images are large and easy to interact with. Two columns often work well. Enter the following CSS in the mobile view:

width: 50% !important;

This sets the column width to 50%, creating two columns (100% divided by 2).

### Fine-Tuning the Layout

At this point, you should have a responsive gallery that adjusts the number of columns based on the screen size. However, you might need to make a few additional tweaks to perfect the layout:

1. **Adding Margins**: If you want to add some spacing between the gallery items, you can do so by adjusting the margin values. For instance, to add a 5-pixel margin, you can use:

margin: 5px;

Remember, adding margins will affect the overall width, so you might need to adjust the width percentage accordingly.

2. **Full-Width Layout**: To make the gallery full-width, you don’t need any additional CSS. Simply adjust the row settings within Divi. Click on the green tab for the row containing your gallery, go to the Design tab, and under Sizing, set both the Width and Max Width to 100%.

### Preview and Adjust

After applying your changes, save your work and preview the gallery on different devices to ensure everything looks great. Here’s a step-by-step recap of what you should do:

1. **Save Changes**: Make sure to save the changes within the Gallery module and the page itself.

2. **Preview on Desktop**: Exit the Visual Builder and check the gallery on a desktop screen to see the full eight-column layout.

3. **Preview on Tablet and Mobile**: Use your browser’s developer tools (F12 in Chrome) to simulate different devices. Check how the gallery adjusts on an iPad and an iPhone. Make sure the columns appear as intended and that the layout looks clean.

### Additional Tips and Best Practices

– **Experiment with Different Column Numbers**: Depending on your design preference and the number of images, you might want to experiment with different column numbers. The process is the same; just divide 100% by the number of columns you want and apply that percentage width.

– **Use Percentage-Based Margins**: For a more fluid and responsive design, consider using percentage-based margins instead of fixed pixels. This ensures better scalability across various screen sizes.

– **Test Across Multiple Devices**: Always test your design on multiple devices to ensure consistency and usability. What looks good on one device might not work as well on another, so it’s important to make adjustments as needed.

– **Keep CSS Organized**: When adding custom CSS, keep it organized and well-documented. This makes it easier to understand and modify in the future. Comment your code to explain what each section does, especially if the CSS file becomes large.

### Conclusion

And there you have it! By following these steps, you can customize the column structure of your Divi gallery to create a responsive and visually appealing layout that looks great on any device. This approach not only enhances the user experience but also gives you greater control over your website’s design.

I hope you found this tutorial helpful. If you enjoyed learning how to use simple CSS to customize your Divi gallery, be sure to check out our other tutorials and our Simple CSS playlist. If you have any questions or run into any issues, feel free to leave a comment below. Your feedback is always appreciated, and it helps us create more content that meets your needs.

Don’t forget to like, share, and subscribe to our channel for more web design tips and tricks. Thanks for watching, and happy designing!

Once again, this has been Jamie from System22 and Have a great day!

Try out the Divi theme:

Divi Supreme Modules Pro Plugin 10% Off:

Divi Supreme Modules Light Plugin:

Divi Supreme Modules Playlist: v=ZAO2MH0dQtk&list=PLqabIl8dx2wo8rcs-fkk5tnBDyHthjiLw

Playlist page for more videos on this:

Full Ecommerce Site Build Playlist: v=rNhjGUsnC3E&list=PLqabIl8dx2wq6ySkW_gPjiPrufojD4la9

Contact Form With File Upload Video:

Divi 4 Theme Create An Ecommerce Store In One Hour:

Check out our playlist page for more videos on this:



Why Divi?

Divi is a popular WordPress theme known for its ease of use and versatile design. It is a versatile theme that can be used for a variety of websites, including business, personal, and eCommerce stores.

The Divi Theme offers a wide range of customization options, allowing users to create a unique website that is tailored to their needs. The theme has a drag and drop page builder, which makes it easy to create custom layouts and pages. This feature makes it easy to customize the look and feel of your site without having to do any coding.

The Divi Theme also offers a variety of pre-made layouts and designs, making it easy to find something that meets your needs. It also has a library of modules, which are snippets of code that can be used to add functionality to your website. This makes it easy to add contact forms, social media buttons, and other features to your website quickly and easily.

The Divi Theme also comes with a wide range of customization options, allowing users to easily change the colors, fonts, and other elements on their website. It also has a wide range of plugins, which can be used to extend the functionality of the theme and add more features to your website.

The Divi Theme is also optimized for speed and performance, making sure that your website loads quickly and runs smoothly. It is also optimized for search engine optimization, making sure that your website is visible in search engine results.

The Divi Theme also comes with a wide range of support options, including video tutorials and a dedicated support forum. This makes it easy to get help if you have any questions or need assistance with the theme.

Overall, the Divi Theme is a great option for anyone looking to create a professional website quickly and easily. It is easy to use, versatile, and offers a wide range of customization options. It is also optimized for speed, performance, and search engine optimization, making sure that your website is visible in search engine results. With its powerful features and great support options, the Divi Theme is an excellent choice for
anyone looking to create a website.

The Awesome Perks of Using the Divi Theme for Your Website!

Hey there, fellow website enthusiast! Let’s talk about Divi, the ultimate game-changer in the world of web design. If you’re looking to create a jaw-dropping website without breaking a sweat, then Divi is your new best friend. With its user-friendly drag-and-drop builder and tons of cool features, Divi makes website building fun and easy for everyone, regardless of your skill level.

First off, let’s chat about Divi’s super-flexibility. Whether you’re a seasoned pro or just dipping your toes into the web design world, Divi’s got your back. With its intuitive builder, you can customize every inch of your site to your heart’s content. From funky layouts to snazzy animations, Divi lets you unleash your creativity like never before.

But wait, there’s more! Divi comes packed with a treasure trove of pre-designed layouts and modules that’ll save you loads of time and hassle. Seriously, with hundreds of templates to choose from, you’ll have your dream website up and running in no time. Plus, Divi’s customization options are off the charts. Want to tweak the fonts, colors, or spacing? No problemo! With Divi, the world is your oyster.

And here’s the best part – Divi isn’t just about looks; it’s about performance too. With its lightning-fast load times and seamless responsiveness, your website will be running like a well-oiled machine in no time. Plus, Divi’s got all the bells and whistles you need to boost your SEO, rock social media, and even start selling stuff online. It’s like having a Swiss Army knife for your website!

So, if you’re ready to take your website to the next level, look no further than Divi. With its user-friendly interface, endless customization options, and top-notch performance, Divi is the ultimate choice for anyone looking to create a killer website without breaking a sweat. Give it a whirl and see for yourself – you won’t be disappointed!

Free Stock Photos

Stock photos are essential when you’re building a website. Of course it’s quite possible to build a website not using any photos or images, but it’s going to be a pretty uninteresting looking site, even if the content is top-notch. Adding images to any website creates an interest factor, attracts the eye and will surely make your visitors more likely to read on and see a little more.

There are a huge number of stock photo sites available out there, and they all have some really fantastic looking images ready for you to insert into your site. But buying these images can get quite expensive especially from some of the more well-known sites like Shutterstock.

Free Stock Photos – Where to get an unlimited supply

Free Stock Photos – Where to get an unlimited supply

Have a great website design

It is essential to have a great website design nowadays as so many people tend to shop and find services online. It is also very important to have a responsive website design as almost 50% of today’s browsing is done on smartphones and tablets, I certainly use mine for browsing. If a customer navigates to your site and they have to pinch and zoom to be able to read and navigate, the chances are that they will move away to another site and you will almost certainly lose that customer.

A well-developed website can convey trust and credibility, making people to buy from you, or support you. Whether you are a professional looking for a job, or an expert in your industry: you can show that to the whole world by having a custom responsive website.

Be sure to check out our playlist page to find the help you need!

Latest YouTube Videos

Subscribe To Our YouTube Channel

4.5 million views on youtube

Test Out The Divi Theme

IT Certification Category (English)300x250

Elementor Page Builder

Pin It on Pinterest

Share This