Search code examples
htmlcsscss-floatminimize

Want to float the image after minimizing the windows in html?


I am creating a webpage in which there is an image on the extreme left when the browser is maximized but as soon as the browser gets minimized i want the image to move to extreme right .. How to do that ? I tried float but it's not working..


Solution

  • Do you mean minimized to task bar or resize window? because when you minimize to task bar the image don't visible anymore or i miss something? anyway if you mean resize so:

    Use Media Queries:

    img{
        float:right;
    }
    
    @media (min-width: 800px) {
        img{
            float:left;
        }
    }
    

    This cause to image float:right until window's width is under 800px and if the browser's width resize to larger than 800px, the image change to float:left