February 23, 2012

How to Troubleshoot CSS Styles on a Live WordPress Website

I was browsing through the WordPress.org support forums today and came across a question by a user who was creating an image grid on a page. There was a border around the table he created and it wasn’t clear on how to remove it.

Here’s how I found what was causing the border and how it could be removed…all without having to touch a single piece of code on his/her live website.

How to Create an Image Grid in WordPress

First, there are many ways to accomplish a grid of images on a WordPress page or post.

  • The built-in Gallery Feature included in WordPress. Nice step-by-step here.
  • A multitude of image gallery plugins. The most popular by far being NextGen Gallery.
  • Creating a customized page template in your theme.
  • Writing HTML directly into a page and inserting your images and links.
  • Using the Grid Loop feature of the Genesis theme framework. This is what I do mostly, but it’s because my image galleries tend to be links to posts in a certain category.

Method Used and Problem

This user was using #4 in the list above. They chose to create a table in HTML directly inside the page and insert their images and links in each table data cell. The problem that this user was seeing was a border around the table even though they specified that there be no border.

HTML CSS WordPress Conflicts

The Unwanted Borders

This is the code they have:

<table height="100" cellspacing="0" cellpadding="0" bordercolor="#808080" border="0" style="width: 205px;">

Cause

Even though they specified border=0 above, the table was still being given a border around it. I suspected that the table border was being defined by the CSS styling included with the theme they were using. I took a look at the CSS code and here’s what I saw.

How to Find CSS in WordPress Themes

Table HTML on Left - CSS Styles Affecting it on Right

Solution

You can see in the image above that there is definitely CSS there that is specifying a 1px solid border for tables, table headings, and table data cells.

To see if these were the cause of the borders, I simply turned these styles off with my handy web development tool as seen in the image below.

You’ll also notice I can see the .css files where this code exists on the right side.

WordPress Table Borders and How to Remove Them

Turn Off CSS Styles for Tables

How I Found and Offered a Fix

This is no mind blowing secret and many of you reading this may already be familiar with this tool and using it yourself. It’s one of the most popular free Add-ons for Firefox named Firebug.

Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

While using Firebug and looking at the CSS for that that website, I could see the .css files as in the above image. Firebug also allowed me to simply right-click and copy the full path to the stylesheet file in order to share that with the user. Check it out in the image below.

WordPress Theme CSS Styles

Hover or Copy Location to Grab Full URL to CSS File

Summary

At the time of this writing the user hasn’t responded to the thread to update on whether this was the ultimate solution to their issue, but if not, I’m confident that just knowing that the CSS styles were affecting their code was enough to lead them in the right direction. At least I hope so;)

Do You Use Firebug?

Please share your advice and tips with us in the comments section below so we can all learn more.

tutorials delivered by email
* indicates required

Enter Our Ultimate WordPress Giveaway Now

Ultimate WordPress GiveawayThere are over two dozen more premium WordPress plugins, themes, and online business tools up for grabs right here!

WP Modder runs on the Genesis Framework

Genesis Framework

Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!

Take advantage of the 6 default layout options, comprehensive SEO settings, rock-solid security, flexible theme options, cool custom widgets, custom design hooks, and a huge selection of child themes ("skins") that make your site look the way you want it to. With automatic theme updates and world-class support included, Genesis is the smart choice for your WordPress website or blog.

It's so damn good, I've redesigned all of my sites using Genesis and can confidently recommended it to you here.

Want an Awesome Host? We Recommend HostGator

HostGator for WordPress

Since its establishment in 2002, HostGator has been a world-leading provider of web hosting service. Although their office is in Houston, Texas, they provide top-notch service to clients and developers from over 200 countries internationally with a staff of over 600 employees. They offer Shared, Reseller, VPS, and Dedicated server packages for both beginners and professionals alike.

Each of their shared Web Hosting plans includes 24/7/365 support, a 99.9% uptime guarantee, and a 45-day money-back guarantee. If you would like to learn more, please visit their company page.

I use HostGator for the majority of my own sites and I continually recommend them to my clients. Learn more about HostGator now!

Get our FREE WP Topics Newsletter

The WP Topics newsletter is delivered twice monthly and it's jam packed with information on our WordPress People interviews, WordPress tutorials, new and useful plugins, themes, marketing techniques, and more.

We Respect Your Privacy.

tutorials delivered by email
* indicates required

About Adam W. Warner

I’m a web development consultant and instructor specializing in the use of WordPress and WordPress Multisite.My development philosophy focuses on solutions, education, empowerment, and support for my clients. I will provide you the tools to achieve your project goals, and I will show you how to use those tools.

Comments

  1. How to Troubleshoot CSS Styles on a Live WordPress Website #wordpress http://tiny.ly/xWsc

  2. RT @wpmodder: How to Troubleshoot CSS Styles on a Live WordPress Website #wordpress http://tiny.ly/xWsc

  3. How to Troubleshoot CSS Styles on a Live #WordPress Website http://bit.ly/fVbq8s @bkmacdaddy

  4. RT @bkmacdaddy: How to Troubleshoot CSS Styles on a Live #WordPress Website http://bit.ly/fVbq8s

  5. How to Troubleshoot CSS Styles on a Live WordPress Website #WordPress http://tiny.ly/3AmI

  6. As a web designer, I use Firebug only countless times every day. I couldn’t live without it. :)

  7. Dave Cole says:

    I can’t remember what life was like before “Inspect Element” was available on a right-click. Chrome’s developer tools are nearly as good as Firebug.

    Nice walkthrough on the troubleshooting process. Thanks!

    • Hi Dave, thanks for the comment. Yeah, Firebug is THE tool that helped me to really understand CSS. I’ve been tempted to switch to Chrome, but I’m just so familiar with FF and Firebug…I think “invested” is a better term.

      p.s. Dashster looks pretty cool, I’m going to check it out and see if there’s any opportunities there…

      p.s.s. You may be interested to know that my main site is located at http://wpprobusiness.com and we’re currently running a HUGE WordPress giveaway. Something worth entering and/or sharing with your followers? ;)
      http://wpprobusiness.com/wpgiveaway/

Speak Your Mind

*