Limit div html

Asked

Viewed 290 times

-2

I am printing a contents of an array into a div. The problem is that when the array has multiple data it passes to div.

$titles = ""; 
foreach($array_resultados as $key =>$value){
    $titles .= "<div>".$value['title']."</div>"; 
}

And my div

echo" 
    <td class='cal_today'>

        <div class =divtoday>
            ".$titles."</div>
    </td>";

I wanted to print out all the data without any passing the div.

  • 1

    Which of the div is that it passes?

  • is the top div, which passes to the div divtoday.

  • 2

    If you [Dit] the question to clarify doubts, the person who voted negative may reverse the vote.

  • How to pass the div?

  • What is the reason behind a <div>for each element of array?

1 answer

2


If I understand your question correctly, consider the following Ivs:

<div class="um">
    <div class="dois">
        asdf<br />
        asdf<br />
        asdf<br />
        ...
    </div>
</div>

With the following css properties:

.um {
    max-height: 300px;
    display: block;
}

.um .dois {
    border: 1px solid #f00;
    overflow: scroll;
    max-height: inherit;
}

Explaining: you have to define in your css a div father and div son (one and two respectively). To make the div son I used the property inherit, that makes the div son always inherit the max-height value of the father.

See the demonstration here.

  • Prefer <style> a separate CSS, since the question does not include the css tag.

  • @Guill strange comment this, because the author of the answer did not say where the CSS should be put (whether it would be in a separate file or between <style></style>. Perhaps we should reread the answer more carefully.

  • I commented 5 months ago. I can’t remember why I mentioned it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.