Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extend length of border css

Tags:

How do I expand the length of a border past the length of my text? This is what I have so far:

    color: #8C4600;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 15px;
    border-bottom: 1px solid #D1D1D1;

This is the HTML: <li class = "vendors">VENDORS</li>

like image 820
user12074577 Avatar asked Mar 12 '13 20:03

user12074577


People also ask

How do you extend border length in CSS?

CSS borders are placed between the margins and padding of an HTML element. If you want the borders of an HTML element to extend past the width (or height) of that element, you can add CSS padding to the element in order to push the borders outward.

Can we change border length in CSS?

With CSS properties, we can only control the thickness of border; not length. However we can mimic border effect and control its width and height as we want with some other ways.

How do I change the bottom border length in CSS?

Definition and UsageThe border-bottom-width property sets the width of an element's bottom border. Note: Always declare the border-style or the border-bottom-style property before the border-bottom-width property. An element must have borders before you can change the width.

How do you increase border height in CSS?

You can set height to inherit for the height of the table or calc(inherit - 2px) for a 2px smaller border. Remember, inherit has no effect when the table height isn't set. Use height: 50% for half a border.


2 Answers

Use padding and negative margins.

E.g.:

div {
  padding: 1em;
  margin: 0 -1em;
  border-bottom: 1px solid red;
}

The above gives padding on all sides, and negative 1em margin on left and right. You may wish to fiddle w/ that.

like image 123
Jeremy Carlson Avatar answered Sep 28 '22 16:09

Jeremy Carlson


CSS borders are placed between the margins and padding of an HTML element. If you want the borders of an HTML element to extend past the width (or height) of that element, you can add CSS padding to the element in order to push the borders outward.

For example, if your html is <li class=vendors">VENDORS</li> adding padding:0 10px; to your CSS would push the borders outwards on the right and left by 10px.

like image 32
ASGM Avatar answered Sep 28 '22 17:09

ASGM