0

I want that every second line is grey. It works almost, but on the left and the right side, there are a few Pixels white.

Does anybody knows why?

HTML

<div class="recent">
    <h1>Recent Downloads:</h1>
    <div class="row">test</div>
    <div class="row">test</div>
    <div class="row">test</div>
    <div class="row">test</div>
    <div class="row">test</div>
</div>

CSS

.recent {
    position: absolute;
    bottom: 0;
    right: 0;
    height: 30%;
    width: 35%;

background-color: white;
    -webkit-border-top-left-radius: 8px;
    -moz-border-radius-topleft: 8px;
    border-top-left-radius: 8px;
    border-style: solid;
    border-color: white;
}

.recent h1 {
    font-size: 16px;
    font-weight: normal;
    margin-left: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.row {
    background-color: white;
}

.row:nth-child(odd) {
    background: #e0e0e0;
}

http://jsfiddle.net/C8drX/4/

7
  • 6
    You use white borders for your .recent class ... Commented Aug 1, 2014 at 11:26
  • Remove the height from the .recent div? The contents are overflowing. jsfiddle.net/Paulie_D/C8drX/8 Commented Aug 1, 2014 at 11:27
  • You can also use Bootstrap :) Commented Aug 1, 2014 at 11:27
  • 2
    How is Bootstrap helpful here? It's not relevant to the situation. Commented Aug 1, 2014 at 11:29
  • Bootsrap have already in default (I mean, you do not have to code it), evry second line in color (grey) Commented Aug 1, 2014 at 11:35

5 Answers 5

3

You should remove borders from .recent:

.recent {
    border: 0px;
}

and maybe add some padding to .row:

.row {
    padding: 3px;
}

Here is a JSFiddle

Sign up to request clarification or add additional context in comments.

Comments

2

The height of the .recent div is to small. The way I see it, you can do one of four things:

  1. Remove the height property from .recent
  2. increase the height property on .recent
  3. remove a child div from the .recent-div
  4. Like Wil93 sugested, you can remove borders from .recent and add padding to .row

Here is a fiddle where I just removed the height all together:

(/*height:30%;*/)

JSFiddle

Comments

0

It is because you have set

border-color: white;

in

.recent {
    position: absolute;
    bottom: 0;
    right: 0;
    height: 30%;
    width: 35%;

    background-color: white;
    -webkit-border-top-left-radius: 8px;
    -moz-border-radius-topleft: 8px;
    border-top-left-radius: 8px;
    border-style: solid;
    border-color: white;
}

Check Fiddle you will understand

You can simply remove it using

border:none;

Comments

0

You should also use this, replacing the current css rules:

background-color: white;
    -webkit-border-top-left-radius: 8px;
    -moz-border-radius-topleft: 8px;
    border-top-left-radius: 8px;
}

Comments

0

Your .recent div has a border from your user agent stylesheet because you're setting a border-style. Set it to 0 and use padding in your .row divs instead.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.