[css] afbeelding verticaal centreren in dynamische LI

Pagina: 1
Acties:

Onderwerpen


  • TutanRamon
  • Registratie: Februari 2001
  • Laatst online: 08-09 19:53
Ik heb een list waarin de geselecteerde filters in een webshop laat zien. Ik wil nu de afbeelding om een filter te sluiten, verticaal centreren t.o.v. de hoogte van de li. Ik krijg het echter niet voor elkaar:

Afbeeldingslocatie: http://cache.hostmyjpg.com/faa4234683_pre.png

Dit is mijn html/css:

HTML:
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
<html>
 <head>
  <title> New Document </title>
<style type="text/css">
#navlist
{
    margin-left: 0;
    padding-left: 0;
    list-style: none;
    width:310px;
}

#navlist li
{
    padding-left: 10px;
    padding-top:2px;
    padding-bottom:2px;
    background-image: url(flyout-bg.png);
    background-repeat: repeat-x;
    background-position:bottom;
    margin-top:2px;
    border:1px solid #bcbcbc;
}

#navlist ul { list-style: none; }

.close_icon
{
    float:right;
    padding-right:5px;
    padding-top:2px;
    clear:both;
    display:block;
}

.close_icon img
{
    
}


.selectedfilter
{
    font-family:arial,tahoma;
    font-size:10pt;
    font-weight:bolder;
}

.selectedvalues
{
    font-family:arial,tahoma;
    font-size:10pt;
    font-weight:normal;
}
</style>
 </head>

<body>
<ul id="navlist">
    <li>
        <span class="selectedfilter">Schoenen</span>
        <span class="close_icon"><a href="#"><img src="close_sel_icon.png"></a></span>
    </li>
    <li>
        <span class="selectedfilter">Merk</span>
        <span class="close_icon"><a href="#"><img src="close_sel_icon.png"></a></span><br>
        <span class="selectedvalues">Nike, Adidas, Timberland</span>
    </li>
    <li>
        <span class="selectedfilter">Maat</span>
        <span class="close_icon"><a href="#"><img src="close_sel_icon.png"></a></span><br>
        <span class="selectedvalues">46, 47</span>
    </li>
    <li>
        <span class="selectedfilter">Geschikt voor</span>
        <span class="close_icon"><a href="#"><img src="close_sel_icon.png"></a></span><br>
        <span class="selectedvalues">hardlopen, bergbeklimmen, fietsen, wandelen, zwemmen, freestylen</span>
    </li>
</ul>
</body>
</html>

[ Voor 0% gewijzigd door RobIII op 25-08-2011 13:44 . Reden: Code tags toegevoegd ]

We see things as we are, not as they are


  • Flowmo
  • Registratie: November 2002
  • Laatst online: 18-08 08:24
Probeer dit eens:
Cascading Stylesheet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#navlist li
{
    position:relative;
    padding-left: 10px;
    padding-top:2px;
    padding-bottom:2px;
    background-image: url(flyout-bg.png);
    background-repeat: repeat-x;
    background-position:bottom;
    margin-top:2px;
    border:1px solid #bcbcbc;
}

.close_icon
{
    position:absolute;
    right:5;
    top:50%;
    margin-top: - halve hoogte van icoontje;
    clear:both;
    display:block;
}

  • TutanRamon
  • Registratie: Februari 2001
  • Laatst online: 08-09 19:53
Fantastisch, ze staan nu in het midden. Alleen ze staan aan de linkerzijde over de tekst heen. Ik heb ze float:right gegeven in de .close_icon class, maar dat helpt niet. Hoe krijg ik ze nu naar rechts?

We see things as we are, not as they are


  • Flowmo
  • Registratie: November 2002
  • Laatst online: 18-08 08:24
excuseer, heb een typo gemaakt in mijn css. right:5; moet zijn right:5px;.

  • TutanRamon
  • Registratie: Februari 2001
  • Laatst online: 08-09 19:53
Top, nu werkt het. Is die float:right dan overbodig geworden of kan ik die evengoed laten staan?

Bedankt!

[ Voor 5% gewijzigd door TutanRamon op 25-08-2011 14:23 ]

We see things as we are, not as they are


  • Flowmo
  • Registratie: November 2002
  • Laatst online: 18-08 08:24
float:right werkt niet met pos:abs dus die mag je verwijderen.

  • Scrummie
  • Registratie: Februari 2003
  • Laatst online: 29-08 11:46

Scrummie

Think different

TutanRamon schreef op donderdag 25 augustus 2011 @ 14:23:
Top, nu werkt het. Is die float:right dan overbodig geworden of kan ik die evengoed laten staan?

Bedankt!
Misschien handig/interessant voor je om te lezen: http://css.maxdesign.com.au/floatutorial/ :)

Seizoenskaarthouder Feyenoord - Vak T

Pagina: 1