/ Published in: CSS
Add background-color to headings
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<style type="text/css"> body { padding-left:100px; padding-top:100px; } h2 { line-height:1.15; font-size:2.2em; color:#fff; text-transform:uppercase; font-family:sans-serif; width:6em; } .uniform-bg { background:red; position:relative; outline: red solid 0.3em; -moz-outline-offset:-0.04em; } .uniform-bg span { position:relative; } </style> <!--[if lte IE 7]> <style type="text/css"> h2 { border-left:0.3em solid red; padding-top:1px; } .uniform-bg span { padding-right:0.3em; } </style> <![endif]--> [HTML] <h2><span class="uniform-bg"><span>Hello everyone</span></span></h2>
URL: http://www.ajaxline.com/the-even-background-under-the-text