moving div against edge of body tag

N

Netman

Hello!

Is it possible to move div against the edge of body tag?
I would like to have div located in the same place on every monitor
nevermind if it is high resolution or low and nevermind if it is panoramic
monitor or old ordinary crt monitor or notebook monitor

If so, please give me the example how to move div...

Thank you in advance
netman
 
V

VK

Netman said:
Is it possible to move div against the edge of body tag?
I would like to have div located in the same place on every monitor
nevermind if it is high resolution or low and nevermind if it is panoramic
monitor or old ordinary crt monitor or notebook monitor

I assume that by "the edge of body tag" you assume top-left, top-
right, bottom-left and bottom-right corners of the body element so -
lesser some special layouts - top-left, top-right, bottom-left and
bottom-right corners of the browser display area. In this case you
don't need scripting right away, CSS would make it, say:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
HTML {
width: 100%;
height: 100%;
}
BODY {
width: 100%;
height: 100%;
}
DIV#MyDiv1 {
position: absolute;
left: 0; top: 0;
width: 10%; height: 5%;
background-color: yellow;
}
DIV#MyDiv2 {
position: absolute;
left: 90%; top: 0;
width: 10%; height: 5%;
background-color: yellow;
}
DIV#MyDiv3 {
position: absolute;
left: 0; top: 95%;
width: 10%; height: 5%;
background-color: yellow;
}
DIV#MyDiv4 {
position: absolute;
left: 90%; top: 95%;
width: 10%; height: 5%;
background-color: yellow;
}
</style>
</head>
<body>
<div id="MyDiv1">My DIV 1</div>
<div id="MyDiv2">My DIV 2</div>
<div id="MyDiv3">My DIV 3</div>
<div id="MyDiv4">My DIV 4</div>
</body>
</html>

It is just an idea, comp.infosystems.www.authoring.stylesheets
newsgroup may help you with the exact details. If you have further
questions about using CSS for your solution then please post in that
group. If you believe need an extra scripting then ask in this thread.
 
S

SAM

Le 11/4/09 9:46 PM, Netman a écrit :
Hello!

Is it possible to move div against the edge of body tag?
I would like to have div located in the same place on every monitor
nevermind if it is high resolution or low and nevermind if it is panoramic
monitor or old ordinary crt monitor or notebook monitor

Can't you only use CSS ?
If so, please give me the example how to move div...

A div in natural state has always its edges (left and right) against
those of the body.

What did you do to to that div (or to he body) if it'sn't edge to edge ?

More explanations are necessary about that div and its context.
 
N

Netman

Uzytkownik "SAM said:
Le 11/4/09 9:46 PM, Netman a écrit :

Can't you only use CSS ?


A div in natural state has always its edges (left and right) against those
of the body.

What did you do to to that div (or to he body) if it'sn't edge to edge ?

More explanations are necessary about that div and its context.

The content of div is flash or gif banner which has to be placed in the same
place on every kind of monitors.

nt.
 
S

SAM

Le 11/5/09 8:24 PM, Netman a écrit :
The content of div is flash or gif banner which has to be placed in the same
place on every kind of monitors.

What the monitor has to do with the placement of a div in the body of
the document ?
(I expect you don't want the div at rear of the monitor ?)

Once more: where is supposed to be that div ?
- in another one ? styled ? how ?
- in top ? bottom ? of the body (in the html code)


css:
====
#baner { position: absolute; top: 0; left:0;
width: 300px; height: 200px; }
..option { width: 100% }

html:
=====
<body>
<h1>my title</h1>
<p>some content</p>

blah all the content


<img id="baner" class="option" src="advertising.php" alt="">
</body>
 
O

Osmo Saarikumpu

SAM kirjoitti:
#baner { position: absolute; top: 0; left:0;
width: 300px; height: 200px; }
..option { width: 100% }

The latter style rule is superfluous for:
<img id="baner" class="option" src="advertising.php" alt="">

The rule for id being more specific.
 
C

Captain Paralytic

Hello!

Is it possible to move div against the edge of body tag?
I would like to have div located in the same place on every monitor
nevermind if it is high resolution or low and nevermind if it is panoramic
monitor or old ordinary crt monitor or notebook monitor

If so, please give me the example how to move div...

Thank you in advance
netman

I'm afraid it is impossible. DIVs and indeed any other browser based
content (apart from maybe a javascript alert), can only remain within
the confines of the browser itself.
 
O

Osmo Saarikumpu

Thomas 'PointedEars' Lahn kirjoitti:
No, it is not.

I'm sure that you are right, I can't see why, though. I suspect that I
may have some kind of blind spot with selectors. I hope it's not
anything embarrassingly obvious :)
 
S

SAM

Le 11/6/09 9:50 AM, Osmo Saarikumpu a écrit :
SAM kirjoitti:

must read : .option (instead of ..option)
The latter style rule is superfluous for:

As named ... it's an "option" ;-)
The rule for id being more specific.

And the class 'option' with/without can modify too
(without moving the div - object of the question)
 
S

SAM

Le 11/6/09 3:45 PM, Osmo Saarikumpu a écrit :
Thomas 'PointedEars' Lahn kirjoitti:


I'm sure that you are right, I can't see why, though. I suspect that I
may have some kind of blind spot with selectors.

In fact it would have to be :

<style type="text/css">
#baner { position: absolute; top: 0; left:0;
width: 200px; height: 200px; }
#baner.option { width: 100%; }
</style>

(tested Firefox)
 
D

Dr J R Stockton

In comp.lang.javascript message <4271fbfd-5909-4704-a43f-78c86cfcb119@d5
g2000yqm.googlegroups.com>, Fri, 6 Nov 2009 06:33:31, Captain Paralytic
I'm afraid it is impossible. DIVs and indeed any other browser based
content (apart from maybe a javascript alert), can only remain within
the confines of the browser itself.

All that seems absolutely necessary, in at least some browsers including
Firefox and Safari, is to put the DIV within a suitably-positioned child
window generated with window.open :

xx = window.open("", "")
xx.document.writeln("<pre>ABCDEFG<\/pre>")
xx.moveTo(10,10)
xx.document.close()

Settings may affect whether it opens a new window or a new tab.
You may need to advise the user on those and other settings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top