Make anchor whole height of the div for display:block

css, html

Solution

Add `height:100%` to the anchor CSS:

div.mydiv a {
    display:block;
    color:yellow;
    background-color:green;
    height:100%;
}

jsFiddle example

Problem

I have simple html: ``` <div class='mydiv'> <a href='#'>Link</a> <div> ``` and css: ``` div.mydiv { height: 200px; width: 200px; background-color:red; } div.mydiv a { display:block; color:yellow; background-color:green; } ``` I need anchor occupy entire space of the div, for that I added display:block; to my css, but occupies only top line of the div. What is wrong and how can I fix that? Thanks

Original source

Related problems