js/css problem-using the width&height values obtained with js to structure my layout

This is a discussion on "js/css problem-using the width&height values obtained with js to structure my layout" within the JavaScript Forum section. This forum, and the thread "js/css problem-using the width&height values obtained with js to structure my layout are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 21st, 2006, 20:13
Junior Member
Join Date: Jul 2006
Location: Sofia, Bulgaria
Age: 22
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
js/css problem-using the width&height values obtained with js to structure my layout

Hello!

I'm a beginner so please excuse me if I'm asking a dumn question.
I have the following problem- I have obtained the width&height values of an image with js and now I want to use them to structure the rest of my layout.
How can this be done?
Here is my source in case it could be of help to you. I want to assign the obtained w&h to the w&h of the div#container, div#footer, etc.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Layout 1</title>
<script language="javascript" type="text/javascript">
function getImageWidth()
{
return document.getElementById("image_1").width;
}
function getImageHeight()
{
return document.getElementById("image_1").height;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<style type="text/css">
html,body
{
margin:0.5% 0.5% 0.5% 0.5%;
padding:0;
display:inline-block;
}

body
{
font: 76% arial,sans-serif;
}

div#header h1
{
height:80px;
line-height:80px;
margin-bottom:0.5%;
padding-left:10px;
background-color:#ff9999;
width:
}

div#container
{
width:100%;
}

div#content
{
float:left;
margin-bottom:0.5%;
background-color:#00ccff;
}

div#news
{
float:left;
width:25%; /*i can't remove this width because the section positions itself below the content*/
margin-left:-25%;
background:#0099cc;
height:
}

div#footer
{
clear:left;
margin-top:0.5%;
background-color:#ba3f3f;
width:
}
</style>
</head>
<body>
<div id="container">
<div id="header"><h1>Header</h1></div>
<div id="content">
<img src="images/1.jpg" alt="" id="image_1" />
</div>
<div id="news">
<p><strong>3) More stuff here.</strong> very text make long silly make text very very text make long filler very make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very </p>
</div>
<div id="footer"><p>Here it goes the footer</p></div>
</div>
</body>
</html>


Thanks for your time,
Valentin
Reply With Quote

Reply

Tags
jscss, problemusing, width height, values, obtained, structure, layout

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Box of auto width and height? Bolt Web Page Design 2 Apr 14th, 2008 08:20
Tables with 100% width and height Griff Web Page Design 13 Feb 5th, 2008 07:22
floating a div across the whole width and height of a table cell cosmicbdog Web Page Design 3 Feb 1st, 2008 14:26
Pictures disappearing with correct width and height! ChrisTheSoul Web Page Design 3 Sep 3rd, 2007 21:56
Trouble with form controls. Height, width and all that magnetica Web Page Design 7 Aug 10th, 2007 12:47


All times are GMT. The time now is 22:51.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43