• I’m designing my own WP theme. A lot of fun and so far so good, but I run into a problem.

    The padding between the li-items is too large in Safari, while it’s just fine in Opera (both on Mac).

    How do I solve this?

    See my screenshot of both browsers and the CSS-code for the side bar.

    https://www.berkenbosch.net/drop/wp_menu.jpg

Viewing 8 replies - 1 through 8 (of 8 total)
  • Well for Safari in general:

    @media screen and (-webkit-min-device-pixel-ratio:0) {
      li { padding: 0; }
    }

    For Safari 3.0+, this is css3 compatible, so will be also affect other browsers:

    body:first-of-type li {
      padding: 0;
    }

    And for Safari 3.1, which also affects Chrome:

    body:nth-of-type(1) li {
      padding: 0;
    }

    Up to you what you use, and bear in mind that is css for -all- li items.

    You shouldn’t need to use any of the above to fix this issue. will make the css very messy. Padding is already zero.

    Try adding margin:0 to .sidebar ul li.

    Another suggestion might be to use a reset stylesheet which will set all browsers the the same. Here is an example of one – https://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/

    If this doesn’t work are you able to post a link? Does this problem occur in firefox as well?

    Dave.

    Thread Starter soid

    (@soid)

    Thanks a lot guys. I’m gonna fiddle around some more. You’ll hear from me in a bit.

    Thread Starter soid

    (@soid)

    Well, I’ve tried both of your suggestions. And neither seems to work. Firefox has the same problem by the way.

    I would give you an URL to the site, but I’m running it locally for designing purposes. However, here’s my complete CSS code:

    @charset "UTF-8";
    /* CSS Document
    Theme Name: JB_portfolio
    Description: This theme is made by Jeroen Berkenbosch for his photography portfolio.
    Version: 1.0
    Author: Jeroen Berkenbosch
    Author URL: https://www.berkenbosch.net
    */
    
    body, h1, h2, h3, h4, h5, h6, blockquote, p{
    margin: 0;
    padding: 0;
    }
    
    body {
    	background-color: #424242;
    	font-family: "Helvetica Neue", Helvetica, Arial, Sans-Serif;
    	font-size: 1em;
    	line-height: 1.5;
    	color: #FFFFFF;
    	background-position: top;
    	margin-bottom: -4px;
    	padding-top: 0px;
    	padding-right: 0px;
    	padding-bottom: 20px;
    	padding-left: 0px;
    	text-align: center;
    }
    
    a:link, a:visited{
    text-decoration: none;
    color: white;
    font-weight: bold;
    }
    
    a:hover{
    text-decoration: none;
    color: #db1741;
    font-weight: bold;
    }
    
    p{
    padding: 10px 0 0 0;
    }
    
    h1{
    font-family: "Helvetica Neue", Helvetica, Arial, Sans-Serif;
    font-size: 3em;
    padding: 0 0 10px 0;
    }
    
    /*DIVS*/
    
    #wrapper{
    margin: 0 auto 0 auto;
    width: 950px;
    text-align: left;
    }
    
    /*header*/
    #header{
    float: left;
    width: 950px;
    padding-left: 10px;
    font-size: 12px;
    text-transform: uppercase;
    	background-image: url(./header.png);
    	background-repeat: no-repeat;
    	height: 70px;
    }
    
    /*container*/
    #container {
    	width: 770px;
    	margin-top: 0px;
    	margin-right: auto;
    	margin-bottom: 0;
    	margin-left: auto;
    	float: right;
    }
    
    /*post*/
    .post{
    padding: 10px 0 10px 0;
    }
    
    .post h2{
    font-family: "Helvetica Neue", Helvetica, Arial, Sans-Serif;
    font-size: 2em;
    }
    
    .entry{
    line-height: 18px;
    }
    
    p.postmetadata{
    border-top: 1px solid #ccc;
    margin: 10px 0 0 0;
    }
    
    .navigation{
    padding: 10px 0 0 0;
    font-size: 14px;
    font-weight: bold;
    line-height: 18px;
    }
    
    /*sidebar*/
    
    .sidebar {
    	width: 160px;
    	float: left;
    	line-height: 1.5;
    	text-align: left;
    	padding-right: 0px;
    	padding-bottom: 25px;
    	padding-left: 0px;
    	margin-top: 0px;
    	padding-top: 19px;
    	margin: 0;
    	display: inline; /*IE-spul*/
    }
    
    .sidebar ul{
    	list-style-type: none;
    	margin: 0px;
    	padding: 0 10px 0 10px;
    	font-size: 24px;
    	text-transform: uppercase;
    }
    
    .sidebar ul li{
    	padding: 0;
    	text-transform: uppercase;
    }
    
    .sidebar ul li ul li a{
    	font-size: 17px;
    	padding: 0;
    }
    
    /*footer*/
    #footer{
    	height: 1em; /* ie doubles padding-top if he doesn't have "haslayout" */
    	clear: both;
    	float: left;
    	width: 950px;
    	padding-top: 0px;
    	font-size: 12px;
    	text-align: right;
    
    }
    
    #footer p{
    	line-height: 18px;
    }

    Maybe something is interfering with the settings?

    Oh and yes, I still have to cleanup my code ?? Looks messy without the tabs.

    Wait, so now firefox has the issue? You said Safari had the problem.

    I agree with Dave.

    Add this:

    * { margin: 0; padding: 0; }

    That’ll reset all margins and padding to 0 from the outset.

    Thread Starter soid

    (@soid)

    Safari AND Firefox have the same problem.

    I’ve added the code you just supplied, jbbrwcky, but it doesn’t seem to do anything.

    However, I did edit the individual line-height, and it’s a lot less noticeable, which obviously is a good thing.

    When I make a screenshot and use a blending mode in photoshop to align them on top of each other, the first links are perfectly aligned, but the childs aren’t.

    Again: Opera shows them closer together than Safari and Firefox (which show the same height).

    So I’m guessing it’s more of a CSS-interpretation related thing than anything else.

    I also have this strange issue. All margin and padding a set to 0 across the board but Safari 4.0.2 list items on a page post have alot more padding than required. Firefox, Opera are both working in the order i required.

    I have used firebug and safari developer tools and cant find anything.

    I have just noticed that there is an additional <p> tag in safari.

    Any ideas why?

    Just discovered a similar issue this evening while designing an inline list menu. Spent an hour trying to work out why Chrome and Safari were adding a mystery left padding to the list.

    @charset "UTF-8";

    Drop the declaration and the mystery padding disappears!

    I know it is a late reply, but I thought it would be appreciated by those Googling.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How do I remove this strange padding?’ is closed to new replies.