The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Auto width of a background image.

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #174641

    I am trying something a little different, and would like to know if there is a way I can use a larger image and have it resized to fit into the background by using width: 100% in the code shown below.

      position: relative;
      top: 10px;
      left: 90px;
      width: 800px;
      height: 533px;
      background-image: url("spring-800x533.jpg");
      background-repeat: no-repeat;

    Try looking into background-size:cover or background-size:contain.

    Also background-position depending on what you are actually trying to so.


    Thank you Paulie. I will check this out.

    Edit: This worked perfect.

    background-size: 800px 533px;

    I can’t seem to keep up with all the changes in CSS.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.