Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

2 pixel line different color beside text css

2 pixel line different color beside text css

Problem

Is a simple exercice, probably some Solution better than others, but I wonder which is the best to create this kind of structure in html and css:

What I want is the text, then create 2 Pixel line, 1px red and other 1 px green.

Not sure what is the best solution for crossbrowser , want to lines end same time.

Already tried with border, hr , background .. but seems not perfectly finish.

ps-looking for a solution without recurring to a image

Problem courtesy of: Ricardo Rodrigues

Solution

Simple answer is to use a simple tag ( for example) and apply CSS styles to it.

Your text

CSS might look like this:

.line {
    position: relative;
    display: inline-block;
    * display: inline; /* fix for IE bugs */
    * zoom: 1; /* fix for IE bugs */
    height: 1px;
    width: 100px;
    background-color: #f00;
    border-bottom: 1px solid #00f;
    vertical-align: middle;
    margin-bottom: 5px;
}
Solution courtesy of: Joshua

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

2 pixel line different color beside text css

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×