1

I have a PHP search script that parses the results through HTML to be styled. When one of the results is hovered over it is highlighted blue. The results are shown inside which uses border radius to give it curved edges. However, when you hover over a result at the top or bottom of the box where the curves are, the blue overflows the curves. How can I solve this issue?

My HTML is:

<a href='{$row['url']}' class='result'>
    <div class='title'>{$row['title']}</div>
    <div class='url'>{$row['url']}</div>
    <div class='desc'>{$row['description']}</div>
</a>

My CSS is:

#results{
    background:#fff;
    filter:alpha(opacity=80);
    opacity:0.8;
    color:#000;
    width:75%;
    float:left;
    border-radius:0 10px 10px 10px
}

.result{
    font:12px Verdana,Arial,Helvetica,sans-serif;
    display:block;
    padding:7px
}

.result:hover{
    background-color:#d5e2ff
}
5
  • Which browser are you seeing this problem in? Commented Jul 16, 2011 at 9:41
  • On which browser are you seeing this? Commented Jul 16, 2011 at 9:42
  • 1
    I can't seem to replicate your problem. Can you post a screenshot? Commented Jul 16, 2011 at 9:43
  • 1
    just a note, you can't add block-level elements such as div in inline elements such as a w3.org/TR/html4/struct/global.html#h-7.5.3 Commented Jul 16, 2011 at 9:47
  • Thanks. I was assuming that #results was a typo intended to be .result, but if not then I think pixelfreak's answer below should help. Commented Jul 16, 2011 at 9:50

1 Answer 1

5

You are putting the border-radius on #results, but you are adding background-color on .result

I assume #results is a container of .result?

If you want the rounded corner bg to be applied to the individual .result, then put border-radius there. But if you want it applied to the overall container, then apply the background-color to #results

Also, you need to handle border-radius for FF by adding -moz-border-radius:0 10px 10px 10px;

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

3 Comments

Depending on version. Since FF 4.0. Here's the doc
@Callum - Testing in JS Fiddle, adding border radius to .result instead of #results seems to fix your issue. See here: jsfiddle.net/YBc7r/1
@Callum - My mistake, you need to have it in both #results and .result.

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.