Reputation: 6945
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
Upvotes: 3
Views: 3861
Reputation: 8221
You can define the height of your ancor like this
a {height: 100%}
Upvotes: 2
Reputation: 207901
Add height:100%
to the anchor CSS:
div.mydiv a {
display:block;
color:yellow;
background-color:green;
height:100%;
}
Upvotes: 4