css에서border를 사용하지 않고 삼각형을 그립니다
                                            
                                                
                                                
                                                
                                                
                                                
                                                 10553 단어  CSS
                    
일반적으로width/height만 설정하면 자유롭게 신축할 수 있으며, 밑부분의 100% 삼각형이나 유사한width:auto 삼각형도 쉽게 만들 수 있다.
 
 css
.bottom{
    background:
      linear-gradient(to top right, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top left/50% 100%,
      linear-gradient(to top left, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top right/50% 100%;
}
.top{
    background:
      linear-gradient(to bottom right, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top left/50% 100%,
      linear-gradient(to bottom left, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top right/50% 100%;
}
.left{
    background:
      linear-gradient(to top right, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat bottom left/100% 50%,
      linear-gradient(to bottom right, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top right/100% 50%;
}
.right{
    background:
      linear-gradient(to bottom left, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top left/100% 50%,
      linear-gradient(to top left, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat bottom right/100% 50%;
}
.topRight{
    background:
      linear-gradient(to top right, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top left/100% 100%
}
.topLeft{
    background:
      linear-gradient(to top left, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top left/100% 100%
}
.bottomRight{
    background:
      linear-gradient(to bottom right, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top left/100% 100%
}
.bottomLeft{
    background:
      linear-gradient(to bottom left, rgba(255,255,255,0) 50%, #f00 50.5%) no-repeat top left/100% 100%
}
대응하는 브라우저는 IE9~, 진흙 4.4 이후여야 합니다.아마
생각나면 잘해.
Reference
이 문제에 관하여(css에서border를 사용하지 않고 삼각형을 그립니다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/kiwr/items/f3901744198640d2c4a0텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)