knackforge
July 2, 2013
Days back I had a requirement that tested my CSS skills to the core. The requirement was as simple as this "Title text must have a border, that too behind them". A simple representation of my requirement has been shown below.,
---------------------------------------------- TITLE ----------------------------------------------
Being aware of CSS's Border It looked like even 2 minutes would be more than enough to get this work done, But to believe I went through as many as 15+ techniques and 4 hours to achieve this effect. After applying the immense trial and error method I came up with the best approach to get the desired effect. The following steps should be done to get the effect as shown in the above representation.,
Where the background-color property must be the color of your .body, if not use background-image to set the .body's image.
The above CSS sets the border to the immediate div, a span of the h1/h2 tag. We adjust the padding and margin to get this bordered top just behind the text. The below snapshot depicts the exact result of the above implementation.
Hope this share saves some time in your case.
Just like how your fellow techies do.
We'd love to talk about how we can work together
Take control of your AWS cloud costs that enables you to grow!