TransWikia.com

Fit container inside image

Stack Overflow Asked on November 15, 2021

There’s a way to auto fit my div inside my image without use of % in my css? I can fit it using % , but I can’t get responsive . PS : I want to add an scroll inside my div, that my text fit inside my screen and I can scroll it inside

where my screen is an IMG and my text inside my div

.Screen{
    position: absolute;
    top: 20%;
    right: 10%;
    width: 80%;    
    z-index: 1;
}

.text{
    position: absolute;
    top: 23%;
    right: 14%;

    overflow: auto;
    
    width: 73%;
    height: 35%;
    
}

One Answer

.Screen{
    position: relative;
    top: 20%;
    right: 10%;    
}

.text{
    position: absolute;
    top: 10px;
    right: 10px;
    left: 10px;
    bottom: 10px;
    overflow-y: scroll;
}

You can use this. As there were no image in the post you have to adjust the values accordingly. Let me know if you stuck anywhere! Happy coding!

Answered by Mithun Das on November 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP