This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > November 2005 > Can you create a DIV that won't break from its content?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Can you create a DIV that won't break from its content?
|
|
| Sugapablo 2005-11-14, 7:09 pm |
| Is it possible to create a DIV that could be, for example, 300 x 200
pixels and make it so whatever content might appear in it, won't break it?
Let me try to explain:
Let's say I have a site with dynamic content, and I've created a DIV with
the above dimensions. Let's say the content was too big for the DIV. I
don't want the DIV to break and expand past its designated pixels. I'd
prefer for the content to be truncated somehow.
Is this possible?
--
[=============================================================================]
Sugapablo -> http://www.sugapablo.net
[=============================================================================]
| |
|
| Sugapablo wrote:
> Is it possible to create a DIV that could be, for example, 300 x 200
> pixels and make it so whatever content might appear in it, won't break it?
>
> Let me try to explain:
>
> Let's say I have a site with dynamic content, and I've created a DIV with
> the above dimensions. Let's say the content was too big for the DIV. I
> don't want the DIV to break and expand past its designated pixels. I'd
> prefer for the content to be truncated somehow.
>
> Is this possible?
Yes, just set overflow:hidden; or overflow:auto; for that div.
'hidden' will truncate it, 'auto' will make the contents scroll if
they need more space than the div is providing.
I've ignored your follow-up btw, as you didn't state it in the message
(not all newsreaders give a warning when a follow-up is set). This
means others would reply, without seeing the replies that are already
given.
--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
| |
| mbstevens 2005-11-14, 7:10 pm |
| Els wrote:
> Sugapablo wrote:
>
>
[color=darkred]
>
>
> Yes, just set overflow:hidden; or overflow:auto; for that div.
> 'hidden' will truncate it, 'auto' will make the contents scroll if
> they need more space than the div is providing.
This does work perfectly well mechanically. Whenever I start thinking
about doing it, though, an internal alarm goes off. It tells me that
I'm trying to cram too much information onto a single page and that I'm
thinking too much like a print designer. There might still be a
special case where it is warranted, but I can't think of one off the top
of my head.
| |
| Lachlan Hunt 2005-11-14, 7:10 pm |
| Sugapablo wrote:
> Let's say I have a site with dynamic content, and I've created a DIV with
> the above dimensions. Let's say the content was too big for the DIV. I
> don't want the DIV to break and expand past its designated pixels.
Note that by setting the 'height' and 'width', the box should always be
that size and in standards compliant browsers, it will be. IE, however,
incorrectly treats 'height' and 'width' a little bit like 'min-height'
and 'min-width' (not exactly the same, though) and therefore breaks the
rules by increasing the size of the box to fit the content, which sounds
somewhat like the described behaviour that you don't want.
> I'd prefer for the content to be truncated somehow.
overflow:hidden;
--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|