Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

<ul> <li> und float left

Empfohlene Antworten

Veröffentlicht

Hi und hallo.

folgender Code für eine einfache Seitennavigation mit <ul> und <li>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

  <head>

<style type="text/css">

	.productListBrowser {

		list-style-type: none;

	}

	.productListBrowser LI {

		float: left;

	}

</style>

  </head>

<body>

  <div style="text-align: center;">

    <div>Produktseite 1</div>

    <ul class="productListBrowser">

      <li><a href="112.html">1</a></li>


      <li><a href="-212.html">2</a></li>


      <li><a href="-312.html">3</a></li>


      <li><a href="-412.html">4</a></li>


      <li><a href="-512.html">5</a></li>


      <li><a href="-612.html">6</a></li>


      <li><a href="-712.html">7</a></li>


      <li><a href="-812.html">8</a></li>


      <li><a href="-912.html">9</a></li>


      <li><a href="-1012.html">10</a></li>


      <li><a href="-1112.html">11</a></li>


      <li><a href="-1212.html">12</a></li>


      <li><a href="-212.html">nächste ></a></li>

    </ul>

  </div>

  </body>

</html>

Nun möchte ich gerne dieses <ul>, also die Zahlen 1-7, mittig auf meiner Seite ausrichten. Deswegen das "text-align: center" im <div>

Das geht aber leider nicht. Nur wenn ich das "float: left" aus der Styledefinition der <li> rausnehme.

Dann stehen die <li> aber untereinander...

Hat jemand eine Idee?

Nun möchte ich gerne dieses <ul>, also die Zahlen 1-7, mittig auf meiner Seite ausrichten.

Deinen Code kopiert und im Browser angesehen... steht alles in der Mitte :confused:

Firefox 1.5.0.7

Dann IE probiert und selbes Ergebnis.

EDIT:

*Stein hol und schonmal 'm3rry' draufschreib*

EDIT2:

Fehler bemerkt: Hab deine Styles nicht kopiert, da ich nur den Body kopiert hab.

EDIT3:

Is klar... Float nimmt die Elemente aus dem normalen Textfluß. Das Div hat mit denen also nix mehr zu tun.

"Mach doch aus den Blockelementen Inline-Elemente "

Jaaaaaa! Das isses! Danke Danke Danke!

Auch wenn ich die <li> inline mache funzt es nicht...

Geht aber mit inline... mußt natürlich das float entfernen.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.