Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS border-bottom in the middle

Tags:

css

Hello :) Is it possible to have bottom border in the center (without using pictures). Something like separator between list items which doesn't go from edge to edge?

Thanks

like image 785
Curious Programmer Avatar asked Jun 28 '12 07:06

Curious Programmer


4 Answers

You can do that with two elements easily, here's a demo http://jsfiddle.net/slash197/JbFrN/6/

like image 112
slash197 Avatar answered Sep 22 '22 01:09

slash197


Not directly. But if it's OK to insert additional elements just for the sake of the border then you can make these elements less wide than your "proper" list items to achieve the desired effect.

See an example.

like image 32
Jon Avatar answered Sep 21 '22 01:09

Jon


Old post, but I was wondering how to do this effect on a day of 2017
I did it with pseudo element ::after and display: inherit

li::after {
   content: '';
   display: inherit;
   width: 50%;
   margin: 10px auto;
   border-top: 1px solid #DFDFDF;
}
like image 3
xavier bs Avatar answered Sep 24 '22 01:09

xavier bs


I know it's an old question but I found this thread using google.

It can also be accomplished with :after

div:after {
  content: '.';
  display: block;
  height: 1px;
  width: 200px;
  margin: 0px auto;
  text-indent: -9999px;
  border-top: 1px solid #585858;
}
like image 2
gurks0r Avatar answered Sep 23 '22 01:09

gurks0r