2 pièce(s) jointe(s)
Alignement vertical d'éléments avec CSS
Bonjour,
je suis une bille finie en HTML et CSS, mais cette fois je me soigne :mrgreen:
Voici donc mon problème:
j'ai un menu de navigation dont je fournis le code ci-dessous.
Je souhaite aligner 2 elements horizontalement et verticalement.
Je n'y arrive pas :calim2:
voici ce que je souhaite
Pièce jointe 223451
et malheureusement ce que je produis
Pièce jointe 223452
Merci pour vos eclaircissements sur la methode que j'ai employé, vous trouverez le code ci-dessous.
On constatera que les decalages ne sont pas les mêmes à chaque fois et je ne comprend pas comment les elements sont affichés.
Code:
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
| <nav id="sideNav">
<ul id="navigationMenu">
<h4>Gestion des incidents HVS</h4>
<li id="incident">
<a href="http://intraqual/intraqual_prod/Dynamic/xaccueil/cadre_form.aspx?idform=171">
<span class="incident navItem hvr-grow">Déclaration d'incidents</span>
</a>
<a href="M:\COMMUN\VIDEOS DYNAMIC\INCIDENT\Cpt_Pres_Incident_HVS_F.htm" target="_blank">
<span class="incident-demo demo hvr-grow">DEMO</span>
</a>
</li>
<li id="chute">
<a href="http://intraqual/intraqual_prod/dynamic/xAccueil/cadre_form.aspx?idform=175">
<span class="chute navItem hvr-grow">Déclaration de chutes</span>
</a>
<a><span class="chute-demo demo">DEMO</span></a>
</li>
<li id="improvement">
<a href="http://intraqual/intraqual_prod/Dynamic/xaccueil/cadre_form.aspx?idform=169">
<span class="improvement navItem hvr-grow">Proposition d'amélioration</span>
</a>
<a href="M:\COMMUN\VIDEOS DYNAMIC\AMELIORATION\Cpt_Amelioration_FD.htm" target="_blank"><span class="improvement-demo demo hvr-grow" >DEMO</span></a>
</li>
<h4>Accès aux autres modules</h4>
<li id="others">
<a href="http://intraqual/intraqual_prod/Dynamic/xaccueil/cadre_form.aspx?idform=178" target="_blank">
<span class="others navItem hvr-grow">Demande de nouvel <br> article HVS</span>
</a>
<a href="" target="_blank"><span class="others-demo demo hvr-grow" >DEMO</span></a>
</li>
</ul>
</nav> |
Code:
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
| * {
/* A universal CSS reset */
margin: 0;
padding: 0;
}
body {
font-size: 14px;
font-family: Arial, Helvetica, sans-serif;
color: #fff;
}
h2 {
font-size: 30px;
font-weight: normal;
padding: 40px 0 20px;
margin-left: 10px;
}
h4 {
font-weight: normal;
}
h1,
h2,
h3,
h4 {
color: #081071;
font-family: "Myriad Pro", Arial, Helvetica, sans-serif;
text-align: left;
font-size: x-large;
font-weight: bold;
}
h1 {
font-size: 300%;
}
.hvr-grow {
display: inline-block;
vertical-align: middle;
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-grow:hover,
.hvr-grow:focus,
.hvr-grow:active {
transform: scale(1.05);
}
#container {
margin: 0 auto;
}
#sideNav {
float: left;
margin-left: 10px;
height: 100%;
text-align: left;
}
#sideNav span.navItem {
padding: 6px;
padding-top: 20px;
padding-bottom: 20px;
display: block;
color: white;
word-wrap: break-word;
}
#sideNav span {
padding: 5px;
padding-bottom: 20px;
display: block;
color: white;
}
#sideNav a {
text-decoration: none;
display: inline-block;
}
#sideNav h4 {
margin-top: 50px;
}
.navItem {
margin: 10px;
width: 200px;
}
.incident {
border-radius: 5px;
background: #33aae4;
}
.incident-demo {
border-radius: 5px;
background: #33aae4;
}
.incident:before {
display: inline-block;
width: 48px;
height: 48px;
margin-right: 5px;
content: "";
background: url("note.png") no-repeat 0 0;
background-size: 100%;
vertical-align: middle;
}
.chute {
border-radius: 5px;
background: #e47e33;
}
.chute-demo {
border-radius: 5px;
background: #e47e33;
display: block;
}
.chute:before {
display: inline-block;
width: 48px;
height: 48px;
margin-right: 5px;
content: "";
background: url("first-aid.svg") no-repeat 0 0;
background-size: 100%;
vertical-align: middle;
}
.demo {
font-size: xx-small;
width: 32;
height: 32;
}
.demo:before {
display: block;
width: 32;
height: 32;
content: "";
background: url("play-icon.svg") no-repeat 0 0;
background-size: 80%;
}
.improvement {
border-radius: 5px;
background: #15c50a;
}
.improvement-demo {
border-radius: 5px;
background: #15c50a;
}
.improvement:before {
display: inline-block;
width: 48px;
height: 48px;
margin-right: 5px;
content: "";
background: url("heart.svg") no-repeat 0 0;
background-size: 100%;
vertical-align: middle;
}
.others {
border-radius: 5px;
background: #888;
}
.others-demo {
border-radius: 5px;
background: #888;
}
.others:before {
display: inline-block;
width: 48px;
height: 48px;
margin-right: 5px;
content: "";
background: url("hospital.svg") no-repeat 0 0;
background-size: 100%;
vertical-align: middle;
} |