1. Dashboard
  2. Artikel
  3. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. HTML - Webmaster Forum
  2. HTML / Webmaster Forum
  3. HTML & CSS Forum

div "fest nageln"

  • davidos_no.1
  • 26. März 2009 um 16:16
  • davidos_no.1
    Kaiser(in)
    Beiträge
    2.314
    • 26. März 2009 um 16:16
    • #1

    ist es möglich, ein div "fest zu nageln"? wenn man also die seite scrollt, soll das div immer an einer bestimmten position stehen.

    gruß

  • sejuma
    Kaiser(in)
    Reaktionen
    5
    Beiträge
    2.720
    • 26. März 2009 um 16:59
    • #2

    Ja, mit

    Code
    position: fixed;


    Für den IE 6 brauchst du jedoch einen "Woraround"

    [Blockierte Grafik: http://www.ohne-css.gehts-gar.net/img/banner/banner350x20.png]
    sejuma's CSS-Einsteigerkurs

  • davidos_no.1
    Kaiser(in)
    Beiträge
    2.314
    • 28. März 2009 um 22:43
    • #3
    Zitat von sejuma

    Ja, mit

    Code
    position: fixed;


    Für den IE 6 brauchst du jedoch einen "Woraround"


    Ja, das habe ich gemacht, jetzt hängt mein Div aber falsch auf der Seite fest. Wenn ich "fixed" wieder entferne, dann passt es wieder. Muss ich nachdem ich "fixed" hinzugefügt habe nochmal alles neu positionieren?

    Code
    #sidebar {
    		width: 35%;
    		height: auto;
    		margin: 0 0 0 5%;
    		padding: 0;
    		float: left;
    		position: fixed;
    	}
  • sejuma
    Kaiser(in)
    Reaktionen
    5
    Beiträge
    2.720
    • 29. März 2009 um 09:59
    • #4

    Dabei brauchst du noch top/left-Werte.
    Versuch's mal so:

    Code
    #sidebar {
    		width: 35%;
    		top: 0;
                    left: 5%;
    		float: left;
    		position: fixed;
    	}

    Es könnte auch sein, dass fixed und float nicht gleichzeitig funktionieren. Müsste ich nachsehen.

    [Blockierte Grafik: http://www.ohne-css.gehts-gar.net/img/banner/banner350x20.png]
    sejuma's CSS-Einsteigerkurs

  • davidos_no.1
    Kaiser(in)
    Beiträge
    2.314
    • 29. März 2009 um 11:14
    • #5

    Daran habe ich gar nicht gedacht!

    Zitat


    Otherwise, if 'position' has the value 'absolute' or 'fixed', the box is absolutely positioned, the computed value of 'float' is 'none', and display is set according to the table below. The position of the box will be determined by the 'top', 'right', 'bottom' and 'left' properties and the box's containing block.

    Otherwise, if 'float' has a value other than 'none', the box is floated and 'display' is set according to the table below.


    Dann muss ich es halt anders versuchen...Danke!

Tags

  • ie
  • internet
  • http
  • explorer
  • code
  • auto
  • bot
  • bottom
  • div
  • position
  • scroll
  • table
  • box
  • display
  • left
  • blog
  • float
  • sidebar
  1. Datenschutzerklärung
  2. Impressum
Community-Software: WoltLab Suite™