<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$("select#choosebook").change(function(){
$(".title").slideDown("medium");
});
</head>
<body>
<div class="booktitle">
<p>
<font color="red">*</font>Book:
<select id="choosebook">
<option>Choose a Book...</option>
<option>Add new Book...</option>
</select>
<div class="title" style="display:none">**
<font color="red">*</font>Title: <input type="text">
</div>
<font color="red">*</font>Page: <input type="text" class="page">
</div>
</body>
</html>
The div with class "title" still takes up space between the "Book:" input and the "Page:" input, even though it's hidden! Other divs on this web page don't. How can I make it take up no space until the javascript is activated to slide it down?
Thank you!
EDIT: As requested, here is a screenshot of the problem. I'm trying to get rid of the gap between the Book input and the Title input. Before the 'title' input slides down: After the 'title' input slides down:
And here is my CSS:
<style type="text/css">
@import url("layout.css");
.page {
width: 50px;
}
.URL, .booktitle {
margin-left: 24px;
display:none;
}
.title {
display: none;
}
.newtag {
display:none;
}
.amount, .addtag {
width: 100px;
}
.details {
width: 275px;
}
</style>
It's not the div that's creating the space, it's the <br>
you have right after it.
And please, get rid of the <font>
tags. My eyes are bleeding.
If you are talking about the huge space under the Book drop down then that is because of the p
tag that you have open in the HTML but forgot to close it. The p
tag is adding the default margin. Hence the space. Remove the p
tag and the margin should go away.
Also as I mentioned in the comments to your question always add a doctype
to you page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With