• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 HTML/CSS 게시판 레이아웃 만들기 숙제 중에서 float, clear 질문

레이아웃 만들기 숙제 중에서 float, clear 질문

4 글 보임 - 1 에서 4 까지 (총 4 중에서)
  • 글쓴이
  • #136747

    웅개
    참가자
     스크린샷 2025-03-05 052049
    
    
    질문:::
    
    float: left;
    clear: both;
    이거 두개 알려준대로 계속 넣어보는데 옆에 안붙고 자꾸 밑으로 내려가요 ㅠㅠ!
    
    
    
    
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>제목 없음</title>
            <style>
                * {
                    margin: 0;
                    padding: 0;
                }
                .container {
                    width: 600px;
                    height: 200px;
                    font-family: pretendard;
                    margin: 30px;
                    
                                   
                }
                .blog-content {
                width: 400px;
                height: 200px;
                border: solid 1px rgb(141, 14, 14);
                background: #7c7a7a;
                
                
                
                }
                #blog-profile {
                width: 50px;
                height: 50px;
                float: left;
                
                
            }
               
            .blog-name {
                float: left;
                
                
                
                
            }
            #icon1 {
                width: 15px;
                float: right;
                padding-right: 20px;
                
            }
           
           
            .blog-f {
                width: 200px;
                height: 200px;
                background: #000000;
                border: solid 1px rgb(160, 148, 148);
                
                float: left;
                clear: both;
                
                
                
                
                          
            }
           
           
            
           
     
           
           
           
            </style>
     
    </head>
    <body>
        
        <div class="container">
     
            <div class="blog-content">
                
                    
                        <div class="blog-name">
                            <h4>저스디스</h4>
                            <p>2022.08.28</p>
                        </div>
                        
                    
                
                
           
     
                <div style="clear: both;"></div>
                    <h4>우리 헤어지니(prod.로코베리)</h4>
                    <p>이것만 답해줘 이렇게 말해줘<br> 
                        나 없는 네 삶이 더 행복할 걸 확신한다고<br>
                        그래야 흐르는 눈물을 멈출 수 있을 것 같아<br>
                        고마워 이런 남자인데 정말 사랑해줘서<br>
                        <br></p>
                        
                        
               
            </div><!-- left, 블로그 콘텐츠 -->
     
     
          
                    <div class="blog-f">
                       < img src="img/저스디스2.jpg" width="100%">
                    </div><!-- right -->
                   
     
     
     
     
     
        </div><!-- 컨테이너 -->
     
    </body>
    </html>  
    • 이 게시글은 웅개에 의해 3 월, 3 주 전에 수정됐습니다.
    #136752

    codingapple
    키 마스터
    div들 크기를 더 줄이거나 div에 box-sizing 줘봅시다
    #136777

    웅개
    참가자
    <style>
                * {
                    margin: 0;
                    padding: 0;
                }
                .container {
                    width: 600px;
                    height: 200px;
                    font-family: pretendard;
                    margin: 30px;
                    box-sizing: border-box;
                    
                                   
                }
                .blog-content {
                width: 400px;
                height: 200px;
                border: solid 1px rgb(141, 14, 14);
                background: #7c7a7a;
                box-sizing: border-box;
                
                
                
                }
                #blog-profile {
                width: 50px;
                height: 50px;
                float: left;
                
                
            }
               
            .blog-name {
                float: left;
                
                
                
                
            }
            #icon1 {
                width: 15px;
                float: right;
                padding-right: 20px;
                
            }
           
           
            .blog-profile {
                width: 200px;
                height: 200px;
                background: #000000;
                border: solid 1px rgb(160, 148, 148);
                box-sizing: border-box;
                
                float: left;
                clear: both;
                
                
                
                
                          
            }
           
           
            
           
    
    
           
           
           
            </style>
    
    
    </head>
    <body>
        
        <div class="container">
    
    
            <div class="blog-content">
                
                    
                        <div class="blog-name">
                            <h4>저스디스</h4>
                            <p>2022.08.28</p>
                        </div>
                        
                    
                
                
           
    
    
                <div style="clear: both;"></div>
                    <h4>우리 헤어지니(prod.로코베리)</h4>
                    <p>이것만 답해줘 이렇게 말해줘<br> 
                        나 없는 네 삶이 더 행복할 걸 확신한다고<br>
                        그래야 흐르는 눈물을 멈출 수 있을 것 같아<br>
                        고마워 이런 남자인데 정말 사랑해줘서<br>
                        <br></p>
                        
                        
               
            </div><!-- left, 블로그 콘텐츠 -->
    
    
    
    
          
                    <div class="blog-profile">
                       < img src="img/저스디스2.jpg" width="100%">
                    </div><!-- right -->
                   
    
    
    
    
    
    
    
    
    
    
        </div><!-- 컨테이너 -->
    
    
    </body>
    
    박스 사이징 넣었는데 안돼요 ㅠ
    
    
    
    • 이 답변은 웅개에 의해 3 월, 3 주 전에 수정됐습니다.
    #136785

    codingapple
    키 마스터
    가로정렬할 .blog-content에도 float left 줍시다 .blog-profile의 clear 속성은 지웁시다
4 글 보임 - 1 에서 4 까지 (총 4 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠