2017-04-18 3 views
0

나는 내 텍스트와 아이콘이 더 작게하고 싶습니다. 그들은 3 개의 셀마다 2 개의 행으로 나뉩니다. 또한 높이와 너비가 반응하고 사각형에서 사각형으로 변경되지 않도록하려면 어떻게해야합니까?두 테이블 행 사이에 공간을 작게 만드는 방법 css

@import url(https://fonts.googleapis.com/css?family=Fjalla+One); 
 

 
html{ 
 
    height: 100%; 
 
} 
 

 
body{ 
 
    font-family: 'Fjalla One', sans-serif; 
 
    background: #2C3E50; /* fallback for old browsers */ 
 
    background: -webkit-linear-gradient(to top, #4CA1AF, #2C3E50); /* Chrome 10-25, Safari 5.1-6 */ 
 
    background: linear-gradient(to top, #4CA1AF, #2C3E50); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 
 
} 
 

 
.icon{ 
 
    display: inline-block; 
 
    vertical-align: middle; 
 
    -webkit-transform: perspective(1px) translateZ(0); 
 
    transform: perspective(1px) translateZ(0); 
 
    box-shadow: 0 0 1px transparent; 
 
    -webkit-transition-duration: 0.3s; 
 
    transition-duration: 0.3s; 
 
    -webkit-transition-property: box-shadow, transform; 
 
    transition-property: box-shadow, transform; 
 
    display: table-cell; 
 
    vertical-align: middle; 
 
    color: white; 
 
    border: 2px solid black; 
 
    border-radius: 35px; 
 
    width: 180px; 
 
    height: 180px; 
 
    text-align: center; 
 
    background: #007991; /* fallback for old browsers */ 
 
    background: -webkit-linear-gradient(to bottom, #78ffd6, #007991); /* Chrome 10-25, Safari 5.1-6 */ 
 
    background: linear-gradient(to bottom, #78ffd6, #007991); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 
 
} 
 

 
.icon:hover, .icon:focus, .icon:active { 
 
    box-shadow: 0 50px 50px -50px rgba(0, 0, 0, 50); 
 
    -webkit-transform: scale(1.1); 
 
    transform: scale(1.1); 
 
} 
 

 

 

 
.icontext{ 
 
    text-align: center; 
 
    color: white; 
 
    font-size: 30px; 
 
} 
 

 

 

 
table { 
 
    border-spacing: 60px; 
 
    border-collapse: separate; 
 
}
<table align="center"> 
 
    <tr> 
 
    <h1> 
 
    <td class="icon" id="afspraken">Icoon1</td> 
 
    <td class="icon">Icoon2</td> 
 
    <td class="icon">Icoon3</td> 
 

 
    </tr> 
 
    <tr> 
 
     <td class="icontext">Afspraken</td> 
 
     <td class="icontext">Grenzen</td> 
 
     <td class="icontext">Situaties</td> 
 
    </tr> 
 
</table>

답변

1

난 당신이 그렇게이 아이콘을 배치하는 <table>의 선택을 비판하지 않습니다 구현되는 상황을 알지 못한다.

아이콘으로 표 셀을 사용하는 것은 좋지 않은 생각입니다. 더 나은 옵션은 내부에 요소 스타일을 지정하는 것입니다. 나는 <span>을 사용하여 here을 사용했습니다.

html{ 
 
     height: 100%; 
 
    } 
 

 
    body{ 
 
     font-family: 'Fjalla One', sans-serif; 
 
     background: #2C3E50; /* fallback for old browsers */ 
 
     background: -webkit-linear-gradient(to top, #4CA1AF, #2C3E50); /* Chrome 10-25, Safari 5.1-6 */ 
 
     background: linear-gradient(to top, #4CA1AF, #2C3E50); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 
 
    } 
 

 
    .icon{ 
 
     text-decoration: none; 
 
     cursor: pointer; 
 
     display: block; 
 
     -webkit-transform: perspective(1px) translateZ(0); 
 
     transform: perspective(1px) translateZ(0); 
 
     box-shadow: 0 0 1px transparent; 
 
     -webkit-transition-duration: 0.3s; 
 
     transition-duration: 0.3s; 
 
     -webkit-transition-property: box-shadow, transform; 
 
     transition-property: box-shadow, transform; 
 
     vertical-align: middle; 
 
     color: white; 
 
     border: 2px solid black; 
 
     border-radius: 35px; 
 
     width: 160px; 
 
     height: 180px; 
 
     margin: 10px; 
 
     line-height: 180px; 
 
     text-align: center; 
 
     background: #007991; /* fallback for old browsers */ 
 
     background: -webkit-linear-gradient(to bottom, #78ffd6, #007991); /* Chrome 10-25, Safari 5.1-6 */ 
 
     background: linear-gradient(to bottom, #78ffd6, #007991); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 
 
    } 
 

 
    .icon:hover, .icon:focus, .icon:active { 
 
     box-shadow: 0 50px 50px -50px rgba(0, 0, 0, 50); 
 
     -webkit-transform: scale(1.1); 
 
     transform: scale(1.1); 
 
    } 
 

 

 

 
    .icontext{ 
 
     text-align: center; 
 
     color: white; 
 
     font-size: 30px; 
 
     text-decoration: none; 
 
    } 
 

 

 

 
    table { 
 
     border-spacing: 60px; 
 
     border-collapse: collapse; 
 
     text-align: center; 
 
    }
<table align="center"> 
 
    <tr> 
 
     <td><a href="#" class="icon" id="afspraken">Icon1</a></td> 
 
     <td><a href="#" class="icon">Icon2</a></td> 
 
     <td><a href="#" class="icon">Icon3</a></td> 
 
    </tr> 
 
    <tr> 
 
     <td><a href="#" class="icontext">Afspraken</a></td> 
 
     <td><a href="#" class="icontext">Grenzen</a></td> 
 
     <td><a href="#" class="icontext">Situaties</a></td> 
 
    </tr> 
 
</table>
나는 처음부터 시작되었다

참고

, 나는 다르게 많은 일을 할 것입니다. 귀하의 질문에 대한 답변을 위해 귀하의 마크 업과 CSS를 약간 수정했습니다.

+0

안녕, 도움에 대한 모든 감사의 첫 번째. 나는 아마 많은 실수가있는 초보자입니다. 그것을 업데이트하고 어떻게 작동하는지 알려 드리겠습니다. –

+0

답변에서 코드를 업데이트했습니다. 컨텍스트를 볼 수 있도록 전체 코드가 필요하면 그냥 물어보십시오. 도움을 다시 주셔서 감사합니다 –

0

내가 이렇게하면 더 좋을까요?

html{ 
 
    height: 100%; 
 
} 
 

 
body{ 
 
    font-family: 'Fjalla One', sans-serif; 
 
    background: #2C3E50; /* fallback for old browsers */ 
 
    background: -webkit-linear-gradient(to top, #4CA1AF, #2C3E50); /* Chrome 10-25, Safari 5.1-6 */ 
 
    background: linear-gradient(to top, #4CA1AF, #2C3E50); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 
 
} 
 

 
.icon{ 
 
    cursor: pointer; 
 
    display: block; 
 
    -webkit-transform: perspective(1px) translateZ(0); 
 
    transform: perspective(1px) translateZ(0); 
 
    box-shadow: 0 0 1px transparent; 
 
    -webkit-transition-duration: 0.3s; 
 
    transition-duration: 0.3s; 
 
    -webkit-transition-property: box-shadow, transform; 
 
    transition-property: box-shadow, transform; 
 
    vertical-align: middle; 
 
    color: white; 
 
    border: 2px solid black; 
 
    border-radius: 35px; 
 
    width: 160px; 
 
    height: 180px; 
 
    margin: 10px; 
 
    line-height: 180px; 
 
    text-align: center; 
 
    background: #007991; /* fallback for old browsers */ 
 
    background: -webkit-linear-gradient(to bottom, #78ffd6, #007991); /* Chrome 10-25, Safari 5.1-6 */ 
 
    background: linear-gradient(to bottom, #78ffd6, #007991); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 
 
} 
 

 
.icon:hover, .icon:focus, .icon:active { 
 
    box-shadow: 0 50px 50px -50px rgba(0, 0, 0, 50); 
 
    -webkit-transform: scale(1.1); 
 
    transform: scale(1.1); 
 
} 
 

 

 

 
.icontext{ 
 
    text-align: center; 
 
    color: white; 
 
    font-size: 30px; 
 
} 
 

 

 

 
table { 
 
    border-spacing: 60px; 
 
    border-collapse: collapse; 
 
    text-align: center; 
 
}
<table align="center"> 
 
    <tr> 
 
    <h1> 
 
    <td><input type="button" class="icon" value="Icoon1") /></td> 
 
    <td><input type="button" class="icon" value="Icoon2") /></td> 
 
    <td><input type="button" class="icon" value="Icoon3") /></td> 
 
    </tr> 
 
    <tr> 
 
     <td class="icontext">Afspraken</td> 
 
     <td class="icontext">Grenzen</td> 
 
     <td class="icontext">Situaties</td> 
 
    </tr> 
 
</table>