search

Home  >  Q&A  >  body text

javascript - css layout problem! Come to God

Code effect
http://u6.gg/Xbj

I want to put the avatar into the frame and make it adaptive.

Here comes a master to help me change the code.

世界只因有你世界只因有你2841 days ago547

reply all(5)I'll reply

  • PHP中文网

    PHP中文网2017-05-18 11:03:03

    1. .bg adds relative positioning;

    2. Put a p outside the avatar and use absolute positioning, set the size you want; Use percentages for all key units

    3. Avatar setting width, height100%

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-18 11:03:03

    img length and width are 100%

    reply
    0
  • 为情所困

    为情所困2017-05-18 11:03:03

    Image adaptive img {max-width: 100%;}
    Place that person in the picture

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-18 11:03:03

    Add class: <img class="img-box" src="./0.jpg" class="avatar">

    class style:

    .img-box {
    position: absolute;
    left: 150px;
    top: 25px;
    width: 122px;
    height: 124px;
    }
    .bg {
    position: absolute;
    }
    You should find the cut image People want specific sizes, I made them by manual debugging

    reply
    0
  • PHP中文网

    PHP中文网2017-05-18 11:03:03

    .bg {
        position: relative;
    }
    
    .avatar {
        position: absolute;
        top: 9%;
        left: 14.5%;
        width: 12%;
    }
    
    .top-bg {
        width: 100%;
        position: relative;
        z-index: 2;
    }

    Change the window size as you wish

    reply
    0
  • Cancelreply