CSS: Border Radius

Asked

Viewed 261 times

5

I’m doing a project where I’m using the border radius to make a vertical menu.
I would like the Menu to have the border Radius straight, this rounded shape : inserir a descrição da imagem aqui

And it’s actually getting this way:

.teste{
	height:12%;
	width:65%;
	background-color: rgb(56, 66, 65);
	opacity:0.5;
	position:absolute;
	margin-left:30%;
    border: 2px solid red;
	border-bottom-left-radius: 250px 170px;
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Menu Vertical</title>
</head>
<body>
<div id="teste" class="teste"> </div>
</body>
</html>

How do I get straight?

Show 2 more comments

1 answer

4


Is not with border-radius, for Radius = radius, that is, this property creates a radius of curvature at the vertices of the div so it gets rounded.

But with a pseudo-elemento and skewX() you can.

.teste{
	height:12%;
	width:65%;
	background-color: rgb(56, 66, 65);
    color:#ddd;
	position:absolute;
	margin-left:30%;
    padding-left: 50px; /* mesma largura que o elemento after */
    border: 2px solid red;
    border-top: none;
    border-right: none;
    box-sizing:border-box;
}
.teste::after {
    content: '';
    position: absolute;
    height: 100%;
    width: 50px;
    background-color: rgb(56, 66, 65);
    top: 0px;
    left: -25px;
    border: 2px solid red;
    border-top: none;
    border-right: none;
    transform: skewX(25deg);
}
    <div id="teste" class="teste"></div>

  • I will study this code @hugocsl, thank you very much !! perfect

  • What does ::after mean

  • @Sora then VERY briefly a ::after is a pseudo-element, are element built in CSS, they are not html tags, the subject is a bit extensive, but it is not difficult to understand. I will point out an article that is worth stopping 15min to take a look, it will be more didactic than I try to explain here in the rss comment, give a look here that will open your head https://www.devmedia.com.br/css-known-os-pseudo-elements/38183

  • I’ll read it, thank you !!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.