I am trying to get a certain look in pure css (no images).
I have:
<h2>
<a>TITLE</a>
</h2>
I would like the title text to have a black background with the same width as the text, but with a different height.
I tried this various permutations: (i.e. span in the link, range in h2, h2 displays the line and block block)
<h2 class="title section-title">
<a href="<?php echo site_url(); ?>/artwork/illustrations" >
Illustrations<span class="title-bg"></span>
</a>
</h2>
If I get the width to the right, I cannot change the height because the span is an inline element. If I get the height on the right by making the block a block, I cannot change the width of the width of the text, since it is now a block level element and expands to be the entire width of the page.
Any ideas, or will I just have to use an image?
source
share