• 회원가입
  • 로그인
  • 구글아이디로 로그인

[border] CSS - border-radius 속성 ★ - 테두리둥글기 지정 (= border-radius속성 = 보더레이디어스속성) (IE9+) ※ 모든 (테두리/꼭지점/모서리)를 둥글게

목차
  1. border-radius 예제 - 테두리 둥글게 하기
  2. border-radius 정의
  3. border-radius 구문 ★
  4. border-radius 예제 - 속성값 개수별 효과
  5. border-radius 예제 - 타원형 사각형
  6. border-radius 예제 - em 단위로 둥글게 하기
  7. border-radius 예제 - 네 꼭지 모두 50% 이상 시 모두 둥근원
  8. border-radius 예제 - 액자 효과
  9. border-radius 예제 - <table> 태그 테두리 둥글게 하기

 

border-radius 예제 - 테두리 둥글게 하기 


<style>
#homzzang {
   border-radius: 25px;
    background: #fe96cb;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
</style>  

<p id="homzzang">홈짱닷컴 (homzzang.com)</p>

결과보기

border-radius 정의


요소의 테두리 꼭지를 둥글게 (= 부드럽게) 처리.



1. 

  • 모든 요소에 대해 사용 가능.
  • object-fit 속성 - 컨테이너에 맞게 '<img>/<video>' 크기 조정 방법 지정.
  • object-position 속성 - 콘테이너 내 '<img>/<video>' 위치 조정.

 


2. border-radius 속성은 아래 4개 속성을 한번에 표현. (시계방향)

 

3. 

  • 기본값: 0
  • 상속여부: X
  • 애니효과: O
  • JS구문: object.style.borderRadius="30px"
 
4. IE9 이상 주요 최신 브라우저 모두 지원.
  • 구형 브라우저 경우 접두어 필요. 
  • (크롬,사파리: -webkit- / 파이어폭스: -moz- / 오페라: -o-)
 
 

border-radius 구문 ★

 

selector {border-radius: 1~4 length|initial|inherit;}

 


[속성값]

 

1~4 length

코너 모양 지정. (단위: px, % 등 가능) (기본값: 0)

※ 숫자가 커질수록 둥글게 됨.

 

initial

이 속성의 기본값으로 사용

 

inherit

부모 요소의 속성값 상속

 


[속성값 개수별 의미]


border-radius: 10px; /* 1개 */
(모든 구석을 10px) 만큼 둥글게.

border-radius: 10px 30px; /* 2개 */

(상좌/하우 10px, 상우/하좌 30px) 만큼 둥글게.

border-radius: 10px 30px 50px; /* 3개 */
(상좌 10px, 상우/하좌 30px, 하우 50px) 만큼 둥글게.

border-radius: 10px 30px 50px 70px; /* 4개 */
(상좌 10px, 상우 30px, 하우 50px, 하좌 70px) 만큼 둥글게.
※ 시계 방향.

 

 

border-radius 예제 - 속성값 개수별 효과


<style>
#homzzang1 {
    border-radius: 10px;
    background: #fe96cb;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
</style>
<p id="homzzang1">홈짱닷컴 (homzzang.com)
<br><br>10px;</p>

<style>
#homzzang2 {
    border-radius: 10px 30px;
    background: #fe96cb;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
</style>
<p id="homzzang2">홈짱닷컴 (homzzang.com)
<br><br>10px 30px;</p>

<style>
#homzzang3 {
    border-radius: 10px 30px 50px;
    background: #fe96cb;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
</style>
<p id="homzzang3">홈짱닷컴 (homzzang.com)
<br><br>10px 30px 50px;</p>

<style>
#homzzang4 {
    border-radius: 10px 30px 50px 70px;
    background: #fe96cb;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
</style> 
<p id="homzzang4">홈짱닷컴 (homzzang.com)
<br><br>10px 30px 50px 70px;</p>

결과보기
 

border-radius 예제 - 타원형 사각형


<style>
#homzzang1 {
    border-radius: 50px/15px;
    background: #ff62a1;
    padding: 20px;
    width: 200px;
    height: 150px;
    line-height: 150px;
    text-align:center;
    margin-bottom:30px;
}

#homzzang2 {
    border-radius: 15px/50px;
    background: #ff62a1;
    padding: 20px;
    width: 200px;
    height: 150px;
    line-height: 150px;
    text-align:center;
    margin-bottom:30px;
}

#homzzang3 {
    border-radius: 50%/10%;
    background: #ff62a1;
    padding: 20px;
    width: 200px;
    height: 150px;
    line-height: 150px;
    text-align:center;
    margin-bottom:30px;
}

#homzzang4 {
    border-radius: 10%/50%;
    background: #ff62a1;
    padding: 20px;
    width: 200px;
    height: 150px;
    line-height: 150px;
    text-align:center;
    margin-bottom:30px;
}
</style>

<div id="homzzang1">가로/세로: 50px/10px</div>
<div id="homzzang2">가로/세로: 10px/50px</div>
<div id="homzzang3">가로/세로: 50%/10%</div>
<div id="homzzang4">가로/세로: 10%/50%</div>

결과 보기
 

border-radius 예제 - em 단위로 둥글게 하기

 

<style>

.rounded {

  width:160px;

  background-color: #bdf;

  border:2px solid #1bf;

  padding:0.5em;

  border-radius:0.5em;

  -moz-border-radius: 0.5em;

  -webkit-border-radius: 0.5em;

  overflow:hidden;

}

img {

  width:160px

  height:auto;

  border-radius:0.5em;

  -moz-border-radius: 0.5em; 

  -webkit-border-radius: 0.5em;

}

</style>

<div class='rounded'><img src='https://source.unsplash.com/random'</div>

 

결과보기

※ 이미지 너비가 부모 요소 영역보다 큰 경우 overflow:hidden 속성 필요 
※ 위처럼 이미지의 높이를 auto로 잡고 너비는 부모 영역 내로 설정 권장.
 

border-radius 예제 - 네 꼭지 모두 50% 이상 시 모두 둥근원

 

<style>

div {  

  margin:20px;

  width:200px;

  height:200px;

  line-height:200px;

  text-align:center;

  border:1px solid red;

}


.a { border-radius:50%;}

.b { border-radius:75%;}

.c { border-radius:100%;}

.d { border-radius:25% 50% 75% 100%;}

.e { border-radius:100% 50% 100% 50%;}

.f { border-radius:100% 50% 50% 100%;}

</style>
 

<div class="a">a : 50%</div>

<div class="b">b: 75%</div>

<div class="c">c: 100%</div>

<div class="d">d: 25% 50% 75% 100%</div>

<div class="e">e: 100% 50% 100% 50%</div>

<div class="f">f : 100% 50% 50% 100%</div>

 

결과보기

 

border-radius 예제 - 액자 효과

 

<style>

#hz {

    position:relative; 

    width:100%; 

    min-width:320px;

    height:100px;   

    line-height:100px;

    text-align:center;

    border:2px solid red; 

    border-radius:20px;

    overflow:hidden;

}

.corner {

    position:absolute; 

    width:40px; 

    height:40px;

    border-radius:50%

    background:red;

}

.c1 { left:-20px; top:-20px; }

.c2 { right:-20px; top:-20px; }

.c3 { left:-20px; bottom:-20px; }

.c4 { right:-20px; bottom:-20px; }

</style>


<div id="hz">

  홈짱닷컴 Homzzang.com

  <div class="corner c1"></div>

  <div class="corner c2"></div>

  <div class="corner c3"></div>

  <div class="corner c4"></div>

</div>

 

결과보기

 

border-radius 예제 - <table> 태그 테두리 둥글게 하기

 

<style>

table {

  border-collapse: collapse;

  border-radius: 1em;

  overflow: hidden;

}


th, td {

  padding: 1em;

  background: #ddd;

  border-bottom: 2px solid white; 

}

</style>

 

<table>

  <tr>

    <th>1</th>

    <th>2</th>

    <th>3</th>

  </tr>

  <tr>

    <td>1</td>

    <td>2</td>

    <td>3</td>

  </tr>

</table>

 

결과보기


방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
list CSS - list-style-position 속성 ★ - 리스트 스타일 위치 (= 리스트 마커 위치 = …
box CSS - max-height 속성 - 최대높이 (= 최대세로길이 = max-height속성 = 맥스하이트속…
outline CSS - outline-style (아웃라인스타일) - 테두리 외곽 스타일 (상속 X) : (IE8)
selector CSS - :lang(language) 가상선택자 - 특정언어속성요소 (= 언어선택자 = 랭선택자, IE8)
border CSS - border-left 속성 - 테두리좌측일괄 (= 테두리왼쪽일괄 = border-left속성 = …
box CSS - min-height 속성 - 최소높이 (= 최소세로길이 = min-height속성 = 민하이트속성…
selector CSS - element>element 자식선택자 ★ - 직접 자식요소만 선택. (요소선택자, IE7)
box CSS - padding 속성 ★ - 안쪽여백 (= padding속성 = 패딩속성)
selector CSS - :last-child 가상선택자 - 그 부모의 마지막자식요소인 지정요소 (= :last-child…
border CSS - border-style 속성 ★ - 테두리모양일괄 (= border-style속성 = 보더스타일속…
border CSS - border-top 속성 - 테두리상단일괄 (= border-top속성 = 보더탑속성 / 보더톱속…
table CSS - table-layout 속성 ★★★ - 테이블 셀, 행 및 열을 레이아웃 (= table-layo…
box CSS - margin-top 속성 - 바깥여백상단 (= margin-top속성 = 마진탑속성 = 마진톱속성…
intro CSS - @charset 구문 - 스타일시트 인코딩방식 설정 (= 언어셋지정/문자셋지정 = @charset…
text CSS - text-emphasis 속성 - 텍스트 강조마크의 '모먕/색깔' 일괄 지정 (= 텍스트 글자 위…
selector CSS - ::after 가상선택자 ★ - 요소 뒤에 내용삽입 (= ::after선택자 = 에프터선택자/애프…
selector CSS - element,element 병렬선택자 ★ - 쉼표로 나열된 여러 요소 선택. (= 여러 요소선택…
transform CSS - transform 속성 ★ - 요소 (회전/비틀기/크기확대) 변환 + 마우스 허버 시 줌효과 (=…
flex CSS - align-self 속성(I) ★ - 교차축 기준으로, 아이템 자체 정렬. (= align-sel…
css CSS - zoom 속성 - 요소 확대 (= zoom속성 = 줌속성) ※ IE 하위 브라우저(예: IE6, …
6/25
목록
찾아주셔서 감사합니다. Since 2012