! Nur Fuer profis !

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • ! Nur Fuer profis !

    Hi Profis,

    I'm doing professional Webdesign for a year now, but I've got one question :

    " How can you use a backgroundimage, that is a single stretched or not picture and not tiled ?"

    bye and thanx

    da thasem

  • #2
    With CSS, you can define a single background image that is centered on the screen:

    style="background:url(background.jpg) no-repeat middle center;"

    Stretching it is a bit more difficult. You could try inserting an image <img src=xyz.jpg width=100% height=100%> and putting any content into layers above it. Another, I think more reliable, way would be to find out the browser window's width and height using javascript and passing the values over to a PHP script that generates the background image according to the x/y dimensions... but this is a lot of work, I wouldnt do it.




    Kommentar


    • #3
      use
      style="background-image:url(back.gif); background-attachment:fixed;" to prevent the bg image from rolling when scrolling. (works in IE only, just like the background-position attribute.)
      background-repeat:no-repeat however works in both NN4 and IE3.

      For stretching, there's no other way than pekka's ideas. But remember to add an onResize-handler to your body when using the php-version, so you can adjust the bgimage to the new browser size.
      mein Sport: mein Frühstück: meine Arbeit:

      Sämtliche Code-Schnipsel sind im Allgemeinen nicht getestet und werden ohne Gewähr auf Fehlerfreiheit und Korrektheit gepostet.

      Kommentar

      Lädt...
      X