2013-10-24 134 views
0

这是父DIV外:CSS孩子的div父

.navi { 
    width: 400px; 
    height: 30px; 
    float: right; 
    border-style: solid; 
    border-width: 1px; 
    border-color: #C0C0C0; 
    overflow: hidden; 
} 

而这些孩子的div内:

.aktuelleseite { 
    display: inline-block; 
    width: 20px; 
    height: 20px; 
    border-style: solid; 
    border-width: 1px; 
    border-color: #C0C0C0; 
    text-align: center; 
    color: white; 
    background-color: #404040; 
} 

.blatt { 
    display: inline-block; 
    width: 19px; 
    height: 20px; 
    border-style: solid; 
    border-width: 1px; 
    border-color: #C0C0C0; 
    text-align: center; 
    color: #404040; 
    text-decoration: none; 
} 

他们闹翻了父DIV的,我该怎么做他们总是呆在里面呢?

这是function.php的一部分

if(!in_array(1,$blaetter) AND count($blaetter) > 1) 
     { 
     if(!in_array(2,$blaetter)) { echo '<a href="http://www.stylechica.de/hosen/' . $navi . '" class="blatt">1</a>...'; } 
     else { echo '<a href="http://www.stylechica.de/hosen/' . $navi . '">1</a>'; } 
     } 

    foreach($blaetter AS $blatt) 
     { 
     if($blatt == $seite) { echo '<div class="aktuelleseite">' . $blatt . '</div>'; } 
     else { echo '<a href="http://www.stylechica.de/hosen/' . $navi . 'seite-' . $blatt . '/" class="blatt">' . $blatt . '</a>'; } 
     } 

    if(!in_array($maxseite,$blaetter) AND count($blaetter) > 1) 
     { 
     if(!in_array(($maxseite-1),$blaetter)) { echo '...<a href="http://www.stylechica.de/hosen/' . $navi . 'seite-' . $maxseite . '/" class="blatt">' . $maxseite . '</a>'; } 
     else { echo '<a href="http://www.stylechica.de/hosen/' . $navi . 'seite-' . $maxseite . '/" class="blatt">' . $maxseite . '</a>'; } 
     } 

    } 
?> </div> 

我把它叫做:

<?php 
$wieviele_seiten = $json_output["ProductsSummary"]["TotalPages"]; 
$navi = blaetterfunktion($seite, $wieviele_seiten); 
echo $navi; 
?> 

你可以看到他在这里得到:www.stylechica.de/hosen如果不loeads理由重新加载它,有时API会产生问题

+0

你可以重新创建一个小提琴?尝试向孩子添加'float:left;' –

+0

说明你的场景 – Nitesh

+0

我编辑问题,以便你可以看到更多 – Bunghole

回答

0

您已将width设置为子元素。尝试:

.aktuelleseite { 
    display: inline-block; 
    height: 20px; 
    border-style: solid; 
    border-width: 1px; 
    border-color: #C0C0C0; 
    text-align: center; 
    color: white; 
    background-color: #404040; 
} 

.blatt { 
    display: inline-block;  
    height: 20px; 
    border-style: solid; 
    border-width: 1px; 
    border-color: #C0C0C0; 
    text-align: center; 
    color: #404040; 
    text-decoration: none; 
} 

Try it in fiddle

+0

还是一样 – Bunghole

+1

现在我解决了它,父div应该是<?php $ wieviele_seiten = $ json_output [“ProductsSummary”] [“TotalPages”]; $ navi = blaetterfunktion($ seite, $ wieviele_seiten); echo $ navi;?>改为在function.php中 – Bunghole

+0

Cool - @CaroFiedler – Nitesh