- This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
Viewing 11 posts - 1 through 11 (of 11 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
#This is the HTML:
#This is the CSS:
ul {
background: gray;
width: 50px;
}
ul li a.active {
border-right: 1px solid red;
}
I want the red border of the ‘active’ element to be shown outside the box on a fixed position (no metter the length of the ‘a’ element).
It’s on a CMS and I don’t have control to move the ‘active’ class to the ‘li’ element. How can I do it with this markup?
ul a { display: block;}
Thank You!
And if I want to place the little red border a few pixels outside the box, what do I need to do?
Give it a little trick with white border of anchor tag
ul a { display:block; border-right: 1px solid #fff;}
Hey @jiddisch please check this. http://jsfiddle.net/7fdMh/3/
Just another little note: I actually prefer to put the active class on the outer most element, in this case the `
ul {
background: gray;
width: 50px;
}
ul li a.active {
border-right: 1px solid red;
display:block;
}
You could give all the other anchors a white border, making the red border seem as if it’s outside of the ul. Or you could give the anchors a gray background instead of the ul and then give the anchors a transparent border, so that the whole section can be placed on any colour background and the effect will still apply. I hope that makes sense :P
Or use a box shadow..http://codepen.io/Paulie-D/pen/GrnAt
simply give the anchor width: 100% and the border will render outside the li
Thank You all!
especially to wolfcry911.