본문 바로가기

프로그래밍/HTML5

배경색상

 

<!DOCTYPE html>
<html>
   <meta charset="utf-8">
   <head>
      <title>배경 색상 태그</title>
      <style>
         p:nth-child(1) {font-size:2.0em;}
         p:nth-child(2) {

                               font-size:1.5em;
                               background: rgba(100,100,100, 1);       /* r:red값 g:green값 b:blue값
                               color: rgba(255,255,255,1);                  a:투명도값 0투명 1불투명 */

                            }
         p:nth-child(3) {

                               font-size:1.0em;
                               background: rgba(0,0,0, 0.2);              /* r:red값 g:green값 b:blue값
                               color: rgba(255,255,255,1);                  a:투명도값 0투명 1불투명 */
                            }
         p:nth-child(4) {

                               font-size:0.8em;
                               background:#000000; /* HEX 코드단위 */
                               color:#ffffff;

                            }
         .small {font-size:0.5em;}
      </style>
   </head>
   <body>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
      <p>H<span class="small">2</span>O, consectetur adipiscing elit.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
   </body>
</html>

 

color: rgba(255,255,255,1); r:red값 g:green값 b:blue값 a:투명도값 0투명 1불투명

font-size:100% 글자크기 태그

font-size:1.0em

font-size:16px

 

'프로그래밍 > HTML5' 카테고리의 다른 글

em태그  (0) 2017.09.20
%태그  (0) 2017.09.20
radius  (0) 2017.09.20
padding,margin  (0) 2017.09.20
구조선택자 태그  (0) 2017.09.20