sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
bradwiseathome@hotmail.com's Avatar

Stretch DIV Tag From Middle?


Question posted by: bradwiseathome@hotmail.com (Guest) on July 24th, 2005 12:54 AM
I have a DIV specified like this:

#divStretchArea
{
padding: 0px ;
margin : 0px ;
border: 1px #0C96C3 solid ;
position : absolute ;
overflow-x : auto ;
overflow-y : none ;
width: 70% ;
height: 70% ;
left: 317px ;
top: 70px ;
}

So it sits kind of in the middle of the page. The area takes up some of
the screen, but I want the right edge to be as close to the right edge
of the web page as possible (it's not when I maximize the page), and
the bottom edge to be as close to the bottom as possible minus 100
pixels.

Thanks.

8 Answers Posted
me's Avatar
Guest - n/a Posts
#2: Re: Stretch DIV Tag From Middle?

<bradwiseathome@hotmail.com> wrote in message
news:1111527269.913418.171580@z14g2000cwz.googlegr oups.com...[color=blue]
> I have a DIV specified like this:
>
> #divStretchArea
> {
> padding: 0px ;
> margin : 0px ;
> border: 1px #0C96C3 solid ;
> position : absolute ;
> overflow-x : auto ;
> overflow-y : none ;
> width: 70% ;
> height: 70% ;
> left: 317px ;
> top: 70px ;
> }
>
> So it sits kind of in the middle of the page. The area takes up some of
> the screen, but I want the right edge to be as close to the right edge
> of the web page as possible (it's not when I maximize the page), and
> the bottom edge to be as close to the bottom as possible minus 100
> pixels.
>
> Thanks.[/color]

Which browser?
Signed,
me


bradwiseathome@hotmail.com's Avatar
bradwiseathome@hotmail.com July 24th, 2005 12:57 AM
Guest - n/a Posts
#3: Re: Stretch DIV Tag From Middle?


Browser is IE6 on WinXP-SP1.

Thanks.

me's Avatar
Guest - n/a Posts
#4: Re: Stretch DIV Tag From Middle?

<bradwiseathome@hotmail.com> wrote in message
news:1111788275.035197.60350@l41g2000cwc.googlegro ups.com...[color=blue]
>
> Browser is IE6 on WinXP-SP1.
>
> Thanks.[/color]

Here's the best solution I could come up with, use it in good health.
Good Luck,
me

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
..divstretch { border: 1px #0C96C3 solid; float: left; border-color: #0C96C3
#0C96C3; left: 30%; top: 20%; clip: rect( ); overflow: auto}
body { margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left:
0px}
-->
</style>
</head>

<body bgcolor="#FFFFFF">
<div id="content" style="position:relative; width:70%; height:70%;
z-index:2; visibility: visible; left: ; top: " class="divstretch">
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</body>
</html>


kchayka's Avatar
Guest - n/a Posts
#5: Re: Stretch DIV Tag From Middle?

me wrote:[color=blue]
>
> Here's the best solution I could come up with, use it in good health.[/color]

Did you come up with this all by yourself? Looks suspiciously like some
tool-generated crap.
[color=blue]
> <style type="text/css">
> <!--[/color]

Cargo cult. Putting an embedded stylesheet within html comments hasn't
been needed since some version of Netscape 2 (or was it NS1?).
[color=blue]
> .divstretch { border: 1px #0C96C3 solid; float: left; border-color: #0C96C3
> #0C96C3; left: 30%; top: 20%; clip: rect( ); overflow: auto}[/color]

- What's the point of setting both border shorthand and separate
border-color when they use the same values?
- What's the point of setting empty clip property? It's invalid, anyway.
If you ever validated your code you'd know this right away.
- Left and top properties have no relevance on non-positioned elements,
which include floats.
- Overflow has no relevance without explicit dimensions.
[color=blue]
> body { margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left:
> 0px}[/color]

Bloatware. margin:0 is all you need.
[color=blue]
> <div id="content" style="position:relative; width:70%; height:70%;
> z-index:2; visibility: visible; left: ; top: " class="divstretch">[/color]

Invalid left/top values, unnecessary visibility property. You've also
created a big inconsistency between the inline styles and the class
rules. Is this element supposed to float or be positioned? Or are you
just hacking away until something seems to come out right in WinIE?

Besides, inline styles are almost never a good idea. All those
properties should be part of either the #content or the .divstretch
rules. You're creating a maintenance PITA when you put style rules all
over the place like this.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
me's Avatar
Guest - n/a Posts
#6: Re: Stretch DIV Tag From Middle?

"kchayka" <usenet@c-net.us> wrote in message
news:3aldt0F6cjeurU1@individual.net...[color=blue]
> me wrote:[color=green]
> >
> > Here's the best solution I could come up with, use it in good health.[/color]
>
> Did you come up with this all by yourself?[/color]

Yes, in a manner of speaking.
[color=blue]
> Looks suspiciously like some
> tool-generated crap.[/color]

I used Dreamweaver (albeit an older version) the industry standard for
professional website designers, at least that's what Macromedia says,
possibly you've heard of them, they're the creators of Shockwave, Flash,
Freehand, etc etc etc.
[color=blue][color=green]
> > <style type="text/css">
> > <!--[/color]
>
> Cargo cult. Putting an embedded stylesheet within html comments hasn't
> been needed since some version of Netscape 2 (or was it NS1?).[/color]

Possibly, but it still works and it facilitates pasting an entire web page
with styles into a NG post.
[color=blue][color=green]
> > .divstretch { border: 1px #0C96C3 solid; float: left; border-color:[/color][/color]
#0C96C3[color=blue][color=green]
> > #0C96C3; left: 30%; top: 20%; clip: rect( ); overflow: auto}[/color]
>
> - What's the point of setting both border shorthand and separate
> border-color when they use the same values?
> - What's the point of setting empty clip property? It's invalid, anyway.
> If you ever validated your code you'd know this right away.[/color]

You may well be right, I'm sure I couldn't say. I concern myself with what
works in IE not with what validates.
[color=blue]
> - Left and top properties have no relevance on non-positioned elements,
> which include floats.[/color]

They do if they relate to the parent, in this case the body (at least in
IE).
[color=blue]
> - Overflow has no relevance without explicit dimensions.[/color]

But there are dimensions, they're a percentage of the body. I used an
overflow setting of auto so IE would only create a vertical scrollbar. IIRC
setting overflow X to auto and overflow Y to none would still be the same
thing, at least in IE.
[color=blue][color=green]
> > body { margin-top: 0px; margin-right: 0px; margin-bottom: 0px;[/color][/color]
margin-left:[color=blue][color=green]
> > 0px}[/color]
>
> Bloatware. margin:0 is all you need.[/color]

Indeed, how many extra kilobytes do you suppose it adds?
[color=blue][color=green]
> > <div id="content" style="position:relative; width:70%; height:70%;
> > z-index:2; visibility: visible; left: ; top: " class="divstretch">[/color]
>
> Invalid left/top values, unnecessary visibility property. You've also
> created a big inconsistency between the inline styles and the class
> rules. Is this element supposed to float or be positioned? Or are you
> just hacking away until something seems to come out right in WinIE?[/color]

You got me there, but as you so astutely observed it does work in IE. Thank
you.
[color=blue]
> Besides, inline styles are almost never a good idea. All those
> properties should be part of either the #content or the .divstretch
> rules.[/color]

Possibly, I'm just a simple guy doing the best I can with what I've got.
[color=blue]
> You're creating a maintenance PITA when you put style rules all
> over the place like this.[/color]

That depends on how you define maintainance. We're building websites not
houses. I don't have any trouble determining what styles are applied where.

IMO you omitted two critical points, you failed to prove that what I did
doesn't work in IE (possibly because it does work) and you failed to offer
the OP a working solution.
Signed,
me


kchayka's Avatar
Guest - n/a Posts
#7: Re: Stretch DIV Tag From Middle?

me wrote:[color=blue]
> "kchayka" <usenet@c-net.us> wrote in message
> news:3aldt0F6cjeurU1@individual.net...[color=green]
>>
>> Looks suspiciously like some
>> tool-generated crap.[/color]
>
> I used Dreamweaver[/color]

I should have guessed. Nobody who hand codes would have come up with
some of that crap.
[color=blue]
> IMO you omitted two critical points, you failed to prove that what I did
> doesn't work in IE (possibly because it does work) and you failed to offer
> the OP a working solution.[/color]

But I think I made the point that you don't care much about quality, eh?
;) That's what I was really shooting for.

BTW, I could care less about a solution that only works in IE, since I
would rather create something that works in a WWW context, not just in a
MS environment. It's people like you who can make the web a crappy place
to be for us non-IE users. And there's absolutely no reason for you to
make it this way, either.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
me's Avatar
Guest - n/a Posts
#8: Re: Stretch DIV Tag From Middle?

"kchayka" <usenet@c-net.us> wrote in message
news:3aom4pF6bhcj1U1@individual.net...[color=blue]
> me wrote:[color=green]
> > "kchayka" <usenet@c-net.us> wrote in message
> > news:3aldt0F6cjeurU1@individual.net...[color=darkred]
> >>
> >> Looks suspiciously like some
> >> tool-generated crap.[/color]
> >
> > I used Dreamweaver[/color]
>
> I should have guessed. Nobody who hand codes would have come up with
> some of that crap.[/color]

Then blame Macromedia. IMO it's not profitable to hand code but YMMV and it
almost certainly does.
[color=blue][color=green]
> > IMO you omitted two critical points, you failed to prove that what I did
> > doesn't work in IE (possibly because it does work) and you failed to[/color][/color]
offer[color=blue][color=green]
> > the OP a working solution.[/color]
>
> But I think I made the point that you don't care much about quality, eh?
> ;) That's what I was really shooting for.[/color]

A quality answer must first satisfy the OP's needs, if it fails on that
count then it fails completely.
[color=blue]
> BTW, I could care less about a solution that only works in IE,...[/color]

No doubt but the OP does, remember him? And who said it *only works in IE*
(somone please correct me if I'm wrong)? See above anyway.
[color=blue]
> ...since I
> would rather create something that works in a WWW context, not just in a
> MS environment.[/color]

But the web is an MS enviorment for IE users (sort of).
[color=blue]
> It's people like you who can make the web a crappy place
> to be for us .[/color]

I can't fathom your definition of "crappy" for non-IE users. AFAICT the
solution I offered the OP won't cause a fatal error in any browser on any
OS.
[color=blue]
> And there's absolutely no reason for you to
> make it this way, either.[/color]

I hate to bother you with niggling details but nothing else will achieve the
OP's goal in IE.

I still don't see a working solution for the OP's request in any of your
posts. Are you done now?
Signed,
me


kchayka's Avatar
Guest - n/a Posts
#9: Re: Stretch DIV Tag From Middle?

me wrote:

[snip drivel]

I should learn to stop feeding trolls.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
 
Not the answer you were looking for? Post your question . . .
196,816 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,816 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors