nellygrl
nellygrl

Reputation: 657

Remove Space before text in DIV

I am creating a div for meta data that has a line going through the back of it and for some reason, space is being added to the beginning of the line and I'm not sure why.

Here is the CSS:

.mline {
    border-top: 1px solid #E7E7E7;
    height: 0px;
    margin: 20px 0 20px 0;
    text-align: center;
}
.mline > div {
    background-color: #FFFFFF;
    line-height: 30px;
    padding: 0 5px 0 5px;
    position: relative;
    text-transform: lowercase;
    top: -16px;
}
.mline * {
    display: inline-block;
}
.mline h1 {
    font-size: 12px;
    font-weight: normal;
}
.info {
    line-height: 16px;
}
.info li:after {
    content:" \2022 ";
}
.info li:last-child:after {
    content:"";
}
.liked, .like:hover {
    color: red !important;
}

And here's the HTML:

<section>
    <div class="mline">
        <div>
            <ul class="info">
                <li><a href="{Permalink}">3/5/13</a></li>
                <li><a href="{Permalink}">21 notes</a></li>
                <li><a href="{ReblogURL}">reblog</a></li>
            </ul>
        </div>
    </div>
</section>

You can see the error on my site here: http://nellyswritingroom.tumblr.com/ And in this jsfiddle: http://jsfiddle.net/xrVh4/1/

I'm not sure what's going on because it's definitely not margins or padding. Any help would be greatly appreciated!

Upvotes: 0

Views: 519

Answers (3)

grc
grc

Reputation: 23555

In the jsfiddle example, I assume left padding is being added by default to the ul.info element.

The site, however, has the following lines in newstyle.css:

ul, ol {
    margin-left: 2em;
}

If you don't want any margins or padding, you can clear them with:

.info {
    line-height: 16px; // already there - I'm not adding this
    margin: 0;
    padding: 0;
}

Example

Upvotes: 2

Kevin Lynch
Kevin Lynch

Reputation: 24703

The line is the border-top you have applied. The reason it all can't be seen is because you have covered it with a negative top with the child element, that has a bg color fff

Upvotes: 0

David Thomas
David Thomas

Reputation: 253318

It seems that it is, in fact, padding, on the ul element; adding the following CSS declaration removes that space:

.info {
    padding-left: 0;
    /* other stuff unchanged */
}

JS Fiddle demo.

Upvotes: 0

Related Questions