Responsive grid box with image automatically resize

前端 未结 2 1021
面向向阳花
面向向阳花 2021-01-25 00:23

assume I try to get almost similar kind of result.

So i write this code to get this this kind of box . But the code is not complete Please see my code ,

2条回答
  •  天命终不由人
    2021-01-25 00:49

    I have a great solution with CSS Grids..

    HTML:

    
    
        
          CSS Grid Example
          
          
          
    
        
        
    
            

    CSS:

     .container {
        display: grid;
        grid-template-columns: 66.667% 33.333%;
        grid-template-areas:
          "section aside";
      }
      section {
          grid-area: section;
          display: grid;
          grid-template-columns: 42% 58%;
          grid-template-rows: 281px 501px;
          grid-template-areas:
            "header header"
            "left-left left-right"
      }
          header {
              grid-area: header;
          }
          .left-left {
              grid-area: left-left;
          }
          .left-right {
              grid-area: left-right;
          }
    
      aside {
          grid-area: aside;
          display: grid;
          grid-template-columns: 1fr;
          grid-template-rows: 150px 480px 1fr;
          grid-template-areas:
            "right-top"
            "right-middle"
            "right-bottom";
      }
          .right-top {
              grid-area: right-top;
          }
          .right-middle {
              grid-area: right-middle;
          }
          .right-bottom {
              grid-area: right-bottom;
          }
      img {
        width: 100%;
        height: 100%;
      }
    

    I'm not entirely sure what you meant with "And the thin if our screen size less than this 756 then we will hide this and the maximum width of the container is 1180 px." but a simple media query would definitely do the trick here.

提交回复
热议问题