Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set css border to end in a 90 instead of a 45 degree angle

Tags:

html

css

I have a div with different colors for both the border-bottom and border-right properties. So they are separated via a line leaving the box in a 45 degree angle.

How can I make the bottom-border shorter so that the right border goes all the way to the bottom of the element which would yield a 90 degree angle separator-line?

like image 760
trajectory Avatar asked Aug 31 '11 18:08

trajectory


People also ask

How do you cut the edges of a border in CSS?

Here is another approach using CSS transform: skew(45deg) to produce the cut corner effect. The shape itself involves three elements (1 real and 2 pseudo-elements) as follows: The main container div element has overflow: hidden and produces the left border.

What CSS property gives rounded corners?

The border-radius CSS property rounds the corners of an element's outer border edge.


2 Answers

You can do this with box-shadow.

Demo: jsFiddle

Output:

box-shadow example

CSS:

#borders {     border-bottom: 20px solid black;       box-shadow: 20px 0 0 0 red;     height: 150px;     margin: 30px;     width: 150px; } 

HTML:

<div id="borders"></div> 
like image 194
ThinkingStiff Avatar answered Sep 28 '22 17:09

ThinkingStiff


I solved this issue using border-width. You simply reduce the width of the border at the edges you don't want to see.

If we don't want the border on the upper edge, we can put border-width to 0.

border-width: 0px 5px 5px 5px; border-color:#ddd #000 #000 #000; 
like image 23
Gustav Avatar answered Sep 28 '22 18:09

Gustav