뉴비코더
나는 코딩뉴비
뉴비코더
전체 방문자
오늘
어제
  • 분류 전체보기 (91)
    • 개발입문뉴비 - 국비지원 ( Front End ) (91)
      • html (26)
      • css (58)
      • javascript (6)
      • Library React.js (0)
    • FrontEnd ( Self-study ) (0)
      • html5, CSS3 (0)
      • Vanilla JS (0)
      • Clone Code (0)
    • BackEnd ( self-study ) (0)
      • Library Node.js (0)
      • Python (0)
      • Go (0)

블로그 메뉴

  • 홈
  • 방명록

공지사항

인기 글

태그

  • UL
  • 클론코딩
  • css3
  • js event
  • Transition
  • position
  • HTML
  • 하이퍼링크
  • Javascript 배열
  • psuedo-class
  • 프론트엔드
  • js 생성 함수
  • HTML5
  • 마크업
  • boxmodel
  • js event object
  • 코딩진화
  • padding
  • 가상클래스
  • parseInt
  • Margin
  • ol
  • 국비지원
  • webfont
  • 웹개발입문
  • 웹개발
  • boxmodeling
  • js 이벤트객체
  • transform
  • JavaScript

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
뉴비코더

나는 코딩뉴비

[2021/12/22]국비지원 CSS3 4-(4) float
개발입문뉴비 - 국비지원 ( Front End )/css

[2021/12/22]국비지원 CSS3 4-(4) float

2022. 1. 31. 07:15

 

  • float : 위치 조정 / 주변에 영향 엄청나게 줌
    • float : left  = 왼쪽에 붙이기
    • float : right = 오른쪽에 붙이기
    • clear : both = float을 주게 되면 기준점이나 밑에 깔리는 상위개체가 짜부되는 상황이 생기는데,
                              그 상황을 방지하고 형태를 유지하도록 할 때 주는 property값

 

 


 

float 1

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>float</title>
    <style type="text/css">
        div{width:200px;height:200px;color:#000;font-size:30px;font-weight:bold;}
        #red{float:left;background-color: red;}
        #green{float:left;background-color: green;}
        #blue{float:left;background-color: blue;}
        /* float : left, right */
    </style>
</head>
<body>
    <div id="red">Red</div>
    <div id="green">Green</div>
    <div id="blue">Blue</div>
</body>
</html>

 


결과물 1

 

 


 

float 2

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>float</title>
    <style type="text/css">
        div{font-size:30px;font-weight:bold;color:#fff;}
        #wrap{width:600px;height:600px;background-color: gray;}
        #yellow{width:600px;height:100px;background-color: yellow;}
        #red{float:left;width:300px;height:400px;background-color: red;}
        #green{float:right;width:300px;height:400px;background-color: green;}
        #blue{clear:both;width:600px;height:100px;background-color: blue;}
        /* clear : left, right, both*/
    </style>
</head>
<body>
    <div id="wrap">
        <div id="yellow">Yellow</div>
        <div id="red">Red</div>
        <div id="green">Green</div>
        <div id="blue">Blue</div>
    </div>
</body>
</html>

 

 


결과물 2

저작자표시 비영리 변경금지 (새창열림)
    '개발입문뉴비 - 국비지원 ( Front End )/css' 카테고리의 다른 글
    • [2021/12/22]국비지원 CSS3 4-(5) 정책꾸러미 클론
    • [2021/12/23]국비지원 CSS3 5-(3) (구)우정사업본부 복지포털 소개 클론
    • [2021/12/23]국비지원 CSS3 5-(2) (구)우체국 사이트맵
    • [2021/12/22]국비지원 CSS3 4-(3) 과제1 : 온라인상담게시판 코딩
    뉴비코더
    뉴비코더
    FrontEnd 지망 - 코딩뉴비를 위한(?), 뉴비에 의한, 뉴비의 블로그 - 코딩뉴비의 코딩 학습 기록 - 첨가물 : 약간의 불평/사족

    티스토리툴바