Forums

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

Home Forums CSS To background-repeat or no-repeat

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41143
    cjweb
    Participant

    Hi Folks,

    I have long standing question that I’d love to have answered (and prompted me to sign onto this forum).

    Is there any benefit to specifying “background-repeat: no-repeat;” if the element is sized to fit the background image anyway?

    Example of a graphical title:

    h1 {width: 300px; height: 100px; background: url(‘title.gif’) no-repeat; text-indent: -9999px; overflow: hidden;}

    I do it out of habit and a sense of ‘tidiness’ but I wondered if it might also reduce the page memory load? (as the background image is tiled only once)

    But if the ‘repeat’ property is totally redundant in these cases, I would probably save a lot of time each week by not typing it over and over again.

    Thanks,

    CJ

    #116245
    Kitty Giraudel
    Participant

    Two things in my opinion:
    * Yup, it is kind of redundant since the element has the size of the image
    * But it is a bit more safe in my opinion if in any case the element become wider for X or Y reason

    In the end, it’s up to you.

    #116460
    cjweb
    Participant

    Thanks for the feedback folks!

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