DEV Community

Cover image for How to Style Tables and Images in Gutenberg: A Frmenu Case Study
Emma Stone
Emma Stone

Posted on

How to Style Tables and Images in Gutenberg: A Frmenu Case Study

How to Style Tables and Images in Gutenberg: A Frmenu Case Study
Gutenberg, the default block editor in WordPress, has revolutionized the way we create and design content. Among its many features, styling tables and images seamlessly is a common challenge faced by content creators.

In this comprehensive guide, we'll explore how to effortlessly style tables and center-align images using Gutenberg, using the popular food blog FrMenu as a case study.

Styling Tables in Gutenberg

1. Customizing Table Appearance

Gutenberg provides a straightforward way to create tables, but styling them to match your website's aesthetics may require some customization. Frmenu tackled this challenge with a few simple CSS adjustments:

`
/* Apply styles to Gutenberg tables /
.wp-block-table {
border-collapse: collapse;
border: 2px solid #000; /
Increased border thickness /
background-color: #fafafa; /
Default background color */
}

/* Add slightly more rounded border-radius /
.wp-block-table, .wp-block-table th, .wp-block-table td {
border-radius: 8px; /
Increased border-radius */
}

/* Optional: Add some spacing to improve visual appearance */
.wp-block-table {
margin: 10px 0;
}`

This CSS code enhances the appearance of tables, providing a clean and visually appealing look to Frmenu's content.

2. Increased Border Thickness and Rounded Corners

To make tables stand out and look more modern, Frmenu opted for a slightly thicker border and added rounded corners. This not only improves aesthetics but also contributes to a more engaging user experience.

Center-Aligning Images

1. Simplifying Image Alignment

Center-aligning images in Gutenberg can be achieved effortlessly with a few lines of CSS. Frmenu took advantage of this technique to ensure consistency across its 600 plus pages:


/* Center-align all images */
img {
display: block;
margin-left: auto;
margin-right: auto;
}
By applying this CSS to the entire website, Frmenu automated the center alignment of all images, eliminating the need for manual adjustments on each page.

2. Optimizing Visual Appeal

Center-aligning images not only enhances the visual appeal of the content but also ensures a uniform and professional look across the entire website. Frmenu's decision to automate this process significantly reduced the time and effort required for content creators.

Conclusion

Styling tables and center-aligning images in Gutenberg can be a game-changer for your website's visual appeal. By following the Frmenu case study, you can leverage these techniques to streamline your content creation process.

Remember, the key is to experiment and tailor the styles to match your brand's identity. With Gutenberg's flexibility and a bit of CSS magic, you can transform your content and provide a delightful reading experience for your audience.

Explore these techniques on your WordPress website and witness the impact on both aesthetics and user engagement. Happy styling!

Top comments (0)