/    Sign up×
Community /Pin to ProfileBookmark

Need a little help with tutorial

I tried taking the div with the id ‘note’ and changing its position to absolute, relative, inherit, etc. When I run this page and toggle the ‘hidden’ div, it is place over the other div. What property/style do I modify to get the div to move down the form ?

Thanks

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@skywalker2208Apr 14.2010 — Can you provide a link or can you post the code?
Copy linkTweet thisAlerts:
@bgreer5050authorApr 14.2010 — <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Hidden Div</title>



<style type="text/css">



#main{

width:500px;

height: 20px;

background: lightblue;


}

#hidden {

width:300px;

height:20px;

background: lightgrey;

display: none;


}


#note {

margin: 10px;
}



</style>


<script language="JavaScript">

function toggle(id) {

var state = document.getElementById(id).style.display;

if (state == 'block') {

document.getElementById(id).style.display = 'none';

} else {

document.getElementById(id).style.display = 'block';

}

}

</script>



</head>



<body>

<div id="main">This is not hidden.

<a href="#" onclick="toggle('hidden');">Toggle Div</a>


</div>



<div id="hidden">This is hidden.

<ol>

<li>Diss</li>

<li>Div</li>

<li>Test1</li>

<li>Test2</li>

<li></li>

<li></li>

<li></li>

<li></li>

</ol>

</div>


<div id="note" style="margin: auto">This is hidden.

<ol>

<li>Diss</li>

<li>Div</li>

<li>Test1</li>

<li>Test2</li>

<li></li>

<li></li>

<li></li>

<li></li>

</ol>

</div>

</body>

</html>
Copy linkTweet thisAlerts:
@bgreer5050authorApr 15.2010 — I really need help understanding why this is working as it is.
Copy linkTweet thisAlerts:
@skullsnestApr 21.2010 — Your only allowing that div to have 20px of height, which is all it's registering. take out the

just take out the

height: 20px

and you should be fine.
×

Success!

Help @bgreer5050 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.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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