/    Sign up×
Community /Pin to ProfileBookmark

Screen object and dynamic positioning an image help

I have a school homework problem that I don’t understand. I need to use the screen object to be able to get the size of a user’s screen, then I need to use that information to be able to place an image using dynamic positioning in the middle of the page.

So far, all I have been able to do is get the user’s screen size. I know I need to use position:absolute but I’m unsure of the syntax and how to combine it all together. I upload my sites and images on geocities, if that makes any difference as to the syntax of where my image is located.

Here’s all I have (minus the < and > tags) and if someone could help me with the syntax, it would be much appreciated:

?xml version “1.0”?
!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd

html xmlns = “http://www.w3c.org/1999/xhtml

head
title>B Search</title
script type = “text/javascript”

var scrwidth = screen.width;
var scrheith = screen.height;

img src = “birds01.jpeg”; position: absolute;

/script
/head

body
/body

/html

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @confusedgirl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...