Question

There's about 3 or 4px white space under all images when viewing a page in wordpress. When viewing the same page without wordpress there's no white space under the same images, despite the same code.

Have tried display block, margin and padding set to 0, and removing empty spaces in the html file, but still for some reason there's this image space. Is this something known with wordpress, such as php code messing something up? I'm using <?php bloginfo('template_url');?> + image path for all the images, whereas the original file uses no php and has no image gaps.

Edit: Here are two snapshots from original file and wordpress showing wp's gap.

Original file before wordpress Wordpress snapshot showing gap Using developer tools I could see that it's the div that holds the images and list items that's responsible for the gap. Yet the other divs holding images and lists in the same way don't have gaps, hm..

No correct solution

OTHER TIPS

A quick checklist.. (apologies for it ignoring some of which you stated you've already tried)

  • Does the problem appear in both firefox and chrome? If only chrome it's probably a display: block; missing somewhere.
  • Inspect the element with firefox or chrome to see if wordpress or your theme is inserting any html/css. It may be inserting pre-styled ul li or p tags which you will need to style.
  • Make use of !important to override any css that may be set by wordpress core styles. Gallery styling, for example, is still set in core.

!important example usage (with some ideas as to how your theme or wordpress styling could be affecting it from somewhere)

display: block !important;
margin: 0px !important;
padding: 0px !important;
height: 100% !important;
max-height: 100% !important;
vertical-align: top !important;
font-size: 0 !important;
  • You can also try adding this filter to your functions.php file and then play with the gallery css.

    add_filter( 'use_default_gallery_style', '__return_false' );

Here's a tutorial on styling galleries - http://theme.fm/2011/06/how-to-style-your-wordpress-gallery-43/

There are other filters to remove the auto style inserts by wordpress if you find those are the problem (as it sounds to be)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top