border-radius로 한쪽 모서리 비스듬하게 만들기

border-radius로 한쪽 모서리 비스듬하게 만들기

QA

border-radius로 한쪽 모서리 비스듬하게 만들기

답변 5

본문

1889326059_1704941976.2832.png

 

안녕하세요, border-radius 속성으로 한쪽 모서리가 들어간 디자인을 하려고하는데 이걸 어떻게 하는건지 잘 모르겠습니다...ㅠㅠ 알고 계시는 고수님들 계실까요?

이 질문에 댓글 쓰기 :

답변 5

다음 코드가 도움이 될지 모르겠습니다.


<style>
:root {
    --v-shape-00-tp: 25%;
    --v-shape-00-ratio: 0.5;
    --v-shape-00-width: 300px;
    --v-shape-00-height: calc(var(--v-shape-00-width) * var(--v-shape-00-ratio));
    --v-shape-00-border: 5px;
    --v-shape-00-bgcolor: #fff;
}
.tmpl_wrapper {
    background-color: var(--v-shape-00-bgcolor);
}
.tmpl_shape_00, .tmpl_shape_00 > div {
    position: relative;
    width: var(--v-shape-00-width);
    height: var(--v-shape-00-height);
    background-color: #555;
    clip-path: polygon(calc(
        var(--v-shape-00-tp) * var(--v-shape-00-ratio)
    ) 0%, 100% 0%, 100% 100%, 0% 100%, 0% var(--v-shape-00-tp));
}
.tmpl_shape_00 > div {
    position: absolute;
    top: var(--v-shape-00-border);
    left: var(--v-shape-00-border);
    content: '';
    background-color: var(--v-shape-00-bgcolor);
    width: calc(var(--v-shape-00-width) - var(--v-shape-00-border) * 2);
    height: calc(var(--v-shape-00-height) - var(--v-shape-00-border) * 2);
}
</style>
 
<div class="tmpl_wrapper">
    <div class="tmpl_shape_00">
        <div>this is a text</div>
    </div>
</div>

안녕하세요.

아래의 내용을 참고해 보시겠어요~

 

<!DOCTYPE html>

<html>

<head>

<style>

.box {

width: 200px;

height: 200px;

background-color: #f00;

border-radius: 25px 0 0 0;

}

</style>

</head>

<body>

<div class="box"></div>

</body>

</html>

 

 

 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 129,117
© SIRSOFT
현재 페이지 제일 처음으로