IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Mise en page CSS Discussion :

[CSS] list à largeur variable


Sujet :

Dimensionnement en CSS

  1. #1
    Membre régulier
    Profil pro
    CEO
    Inscrit en
    Avril 2002
    Messages
    84
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : CEO

    Informations forums :
    Inscription : Avril 2002
    Messages : 84
    Points : 74
    Points
    74
    Par défaut [CSS] list à largeur variable
    Bonjour,

    j'ai une liste qui me sert de menu,
    j'essaie de faire des largeurs variables mais rien y fait

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
     
    <div id="menu">
     <ul>
       <li >
        <a href="#" id="menu_0">menu 1</a>
       </li>
     
       <li>
        <a href="#" id="menu_1">menu 2</a> 
       </li>
     
       <li>
        <a href="#" id="menu_2">menu 3</a>
       </li>
     
       <li>
        <a href="#" id="menu_3">menu 4</a>
     
       </li> 
     
       <li>
        <a href="#" id="menu_4">menu 5</a>
       </li>
     
       <li>
        <a href="#" id="menu_5">menu 6</a>
       </li>
     
       <li>
        <a href="#" id="menu_6">menu 7</a>
       </li>
     
      </ul>
    </div>
    le css
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    /* premier niveau */
    div#menu {clear:both; margin-bottom: 2px;}
    div#menu ul {width: 956px;height:30px;float:left;margin:0px;padding:0px;list-style:none;background-image:url(../img/background_menu.gif);background-repeat:repeat-x;}
    div#menu ul li {display:inline;}
    div#menu ul li a {text-decoration:none;font-size:13px;font-weight:bold;color: #FFFFFF;text-align:center;line-height:30px;}
    /* parents */
    #menu_0{width:99px; border-right:1px solid black;}
    #menu_1{width:178px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_2{width:186px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_3{width:167px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_4{width:76px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_5{width:151px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_6{width:86px; border-left:1px solid #b7bbd8;}

  2. #2
    Membre émérite Avatar de franculo_caoulene
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    2 880
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 2 880
    Points : 2 953
    Points
    2 953
    Par défaut
    Salut,

    Largeur variable??? Qu'est-ce que c'est censé donné?

  3. #3
    Membre régulier
    Profil pro
    CEO
    Inscrit en
    Avril 2002
    Messages
    84
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : CEO

    Informations forums :
    Inscription : Avril 2002
    Messages : 84
    Points : 74
    Points
    74
    Par défaut
    un menu horizontal tout simplement

  4. #4
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    30
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 30
    Points : 25
    Points
    25
    Par défaut
    Citation Envoyé par laurent_h
    Bonjour,
    #menu_0{width:99px; border-right:1px solid black;}
    je dirais:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    ...
    #menu_0 {display:block; width:99px; border-right:1px solid black;}
    ...
    peu académique mais bon...

    @+

  5. #5
    Membre émérite Avatar de franculo_caoulene
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    2 880
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 2 880
    Points : 2 953
    Points
    2 953
    Par défaut
    Pas sûr que ça fonctionne et que ce soit possible. Je pense que c'est <ul> qui définit la largeur.

  6. #6
    Membre régulier
    Profil pro
    CEO
    Inscrit en
    Avril 2002
    Messages
    84
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : CEO

    Informations forums :
    Inscription : Avril 2002
    Messages : 84
    Points : 74
    Points
    74
    Par défaut
    Merci de votre aide, voici la solution,
    c'est de mettre float left pour les a

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    /* premier niveau */
    div#menu {margin-bottom: 2px;}
    div#menu ul {width: 956px;height:30px;margin:0px;padding:0px;list-style:none;background-image:url(../img/background_menu.gif);background-repeat:repeat-x;}
    div#menu ul li {display:inline;margin:0;padding:0;}
    div#menu ul li a {float:left;text-decoration:none;font-size:13px;font-weight:bold;color: #FFFFFF;text-align:center;line-height:30px;}
    /* parents */
    #menu_0{width:99px; border-right:1px solid black;}
    #menu_1{width:178px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_2{width:186px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_3{width:167px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_4{width:76px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_5{width:151px; border-left:1px solid #b7bbd8;border-right:1px solid black;}
    #menu_6{width:86px; border-left:1px solid #b7bbd8;}

    Merci encore

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Liste déroulante à largeur variable
    Par Landolsi dans le forum Mise en page CSS
    Réponses: 13
    Dernier message: 12/07/2007, 16h39
  2. [Sécurité] $_ENV => Liste des variables liées
    Par Romanops dans le forum Langage
    Réponses: 8
    Dernier message: 17/04/2007, 15h07
  3. [CSS] Liste à puces et séparateurs en inline
    Par PoZZyX dans le forum Mise en page CSS
    Réponses: 6
    Dernier message: 28/09/2005, 20h31
  4. [CSS] listes imbriquées et conformité W3C
    Par rapathonyk dans le forum Mise en page CSS
    Réponses: 3
    Dernier message: 25/07/2005, 09h40
  5. [CSS] Liste des propriétés
    Par tails dans le forum Mise en page CSS
    Réponses: 6
    Dernier message: 18/04/2005, 16h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo