alykins
04-26-2011, 03:54 AM
Hi, before reading further, remember none of us were born knowing how to code- so please no condescending bs...
anyways- I am new to coding... in the past week i have drilled my head through xhtml and css w/ more intensity than i ever exp in college... UNFORTUNATELY- I am sort of "self teaching"... I have made serious headway and at the end of last week I encountered a snag that I cannot come to terms with. The code I will post is VERY basic... but it does not load correctly... I feel I am missing something bc I have no "formal" teacher... so any help would be great...
What I am trying to do...
Basically just understand these flippin div elements more... What I want (to avoid table base layouts) is to float three div elements (I havent made it past the first two :( )
what my aim is ... I need the "header" div to contain the div elements "headtext" and "headimg"...
then floating to the left of the page the div "leftspace"
the problems...
1 my header div does not stretch around the two divs "headtext" and "headimg" ...
2 the img i have (you wont be able to see) just kinda hangs out to the upper right... it is not contained within its element... Ive tried using <hr> both within the elements headtext/headimg and also in the div header... this does not work either (i took them out, but left code there in case i am writing it wrong)
3) neither of my two divs (headtext or headimg) are within the div header (and they are supposed to be
4 my div leftspace keeps getting thrown into the div element "headimg" ....
i have spent hours looking through forum posts, web resources and the limited printed ref that i have and i see no reason it wont work properly... what am i missing?! :eek:
This is one of my final hurdles b4 i start to learn jscript and it is driving me nuts... its so basic but i cannot figure it out...
also- to the would be "go and validate" i know there are errors with height/width being defined in my body/table elements, but when i removed them i still had same issue.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>title title title title title title title title title </title>
<link rel= "stylesheet"
type= "text/css"
href= "title.css" />
<style type= "text/css">
.header{
border: 3px darkblue solid;
position: relative;
float: top;
clear: both;
width: 100%;
height: 5%;
}
div.item hr{
display: block;
clear: both;
visibility: hidden;
}
.left{
position: relative;
float: left;
clear: left;
width: 5%;
height: 90%;
background-color: black;
}
</style>
</head>
<body height= 720px width= 1024px>
<!-- ----------------------------------------------------------------------------------------
"header" "header" "header" "header" "header" "header" "header" "header" "header" "header" -->
<div class= "header">
<div id= "headtext">
Text in the header section!
</div>
<div id= "headimg">
<img src= "./logo.jpg"
alt= "logo">
<div>
</div>
<!-- "header" "header" "header" "header" "header" "header" "header" "header" "header" "header"
------------------------------------------------------------------------------------------ -->
<!-- -----------------------------------------------------------------------------------------
outer left menu. outer left menu. outer left menu. outer left menu. outer left menu. outer -->
<div id= "left_space" class= "left">
<table height= 100% width= 100% border=1>
<tr height= 60% width= 100% bgcolor= "green">
<td>Text Top </td>
</tr>
<tr height= 40% width= 100% bgcolor= "darkgreen">
<td> Text Bottom </td>
</tr>
</table>
</div>
<!-- outer left menu. outer left menu. outer left menu. outer left menu. outer left menu. outer
------------------------------------------------------------------------------------------ -->
ps- how do you post code inside those nifty scroll boxes?
anyways- I am new to coding... in the past week i have drilled my head through xhtml and css w/ more intensity than i ever exp in college... UNFORTUNATELY- I am sort of "self teaching"... I have made serious headway and at the end of last week I encountered a snag that I cannot come to terms with. The code I will post is VERY basic... but it does not load correctly... I feel I am missing something bc I have no "formal" teacher... so any help would be great...
What I am trying to do...
Basically just understand these flippin div elements more... What I want (to avoid table base layouts) is to float three div elements (I havent made it past the first two :( )
what my aim is ... I need the "header" div to contain the div elements "headtext" and "headimg"...
then floating to the left of the page the div "leftspace"
the problems...
1 my header div does not stretch around the two divs "headtext" and "headimg" ...
2 the img i have (you wont be able to see) just kinda hangs out to the upper right... it is not contained within its element... Ive tried using <hr> both within the elements headtext/headimg and also in the div header... this does not work either (i took them out, but left code there in case i am writing it wrong)
3) neither of my two divs (headtext or headimg) are within the div header (and they are supposed to be
4 my div leftspace keeps getting thrown into the div element "headimg" ....
i have spent hours looking through forum posts, web resources and the limited printed ref that i have and i see no reason it wont work properly... what am i missing?! :eek:
This is one of my final hurdles b4 i start to learn jscript and it is driving me nuts... its so basic but i cannot figure it out...
also- to the would be "go and validate" i know there are errors with height/width being defined in my body/table elements, but when i removed them i still had same issue.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>title title title title title title title title title </title>
<link rel= "stylesheet"
type= "text/css"
href= "title.css" />
<style type= "text/css">
.header{
border: 3px darkblue solid;
position: relative;
float: top;
clear: both;
width: 100%;
height: 5%;
}
div.item hr{
display: block;
clear: both;
visibility: hidden;
}
.left{
position: relative;
float: left;
clear: left;
width: 5%;
height: 90%;
background-color: black;
}
</style>
</head>
<body height= 720px width= 1024px>
<!-- ----------------------------------------------------------------------------------------
"header" "header" "header" "header" "header" "header" "header" "header" "header" "header" -->
<div class= "header">
<div id= "headtext">
Text in the header section!
</div>
<div id= "headimg">
<img src= "./logo.jpg"
alt= "logo">
<div>
</div>
<!-- "header" "header" "header" "header" "header" "header" "header" "header" "header" "header"
------------------------------------------------------------------------------------------ -->
<!-- -----------------------------------------------------------------------------------------
outer left menu. outer left menu. outer left menu. outer left menu. outer left menu. outer -->
<div id= "left_space" class= "left">
<table height= 100% width= 100% border=1>
<tr height= 60% width= 100% bgcolor= "green">
<td>Text Top </td>
</tr>
<tr height= 40% width= 100% bgcolor= "darkgreen">
<td> Text Bottom </td>
</tr>
</table>
</div>
<!-- outer left menu. outer left menu. outer left menu. outer left menu. outer left menu. outer
------------------------------------------------------------------------------------------ -->
ps- how do you post code inside those nifty scroll boxes?