Empty div is invisible
up vote
0
down vote
favorite
I have a div that has a few css styles so that it fits on the page without having to scroll the page
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
Inside this div is nothing. However, it adds <p>
whenever it receives a message from the server. Once it fills, it should have scroll bars that stop it from being too tall. However, this doesn't happen and it continues to fill. It's also invisible when empty. I have searched google and stackoverflow to no avail. Can someone help me understand why my css styles aren't working?
PS: The javascript is just there so it doesn't reload when you click the send button
html css
add a comment |
up vote
0
down vote
favorite
I have a div that has a few css styles so that it fits on the page without having to scroll the page
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
Inside this div is nothing. However, it adds <p>
whenever it receives a message from the server. Once it fills, it should have scroll bars that stop it from being too tall. However, this doesn't happen and it continues to fill. It's also invisible when empty. I have searched google and stackoverflow to no avail. Can someone help me understand why my css styles aren't working?
PS: The javascript is just there so it doesn't reload when you click the send button
html css
Since you're using percentages, you have to make sure that the html/body tags also have a width and height of 100%.
– Jacques
Nov 9 at 19:03
ok whatever. Wait a minute, did you honestly just comment on my question so that you could reply to me?
– Electrox Mortem
Nov 10 at 4:48
@DaveNewton Also, it's listed in my developer story that I'm a mean person.
– Electrox Mortem
Nov 10 at 4:50
@DaveNewton For the intentions of the question that was asked, it seemed to be quite incorrect. Expecially since they were asking for a function calledreduce
, which according to the underline.js docs, was a function for arrays only. What's anFWIW
???
– Electrox Mortem
Nov 10 at 5:16
Hm. Ok. Goodnight
– Electrox Mortem
Nov 10 at 5:27
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a div that has a few css styles so that it fits on the page without having to scroll the page
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
Inside this div is nothing. However, it adds <p>
whenever it receives a message from the server. Once it fills, it should have scroll bars that stop it from being too tall. However, this doesn't happen and it continues to fill. It's also invisible when empty. I have searched google and stackoverflow to no avail. Can someone help me understand why my css styles aren't working?
PS: The javascript is just there so it doesn't reload when you click the send button
html css
I have a div that has a few css styles so that it fits on the page without having to scroll the page
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
Inside this div is nothing. However, it adds <p>
whenever it receives a message from the server. Once it fills, it should have scroll bars that stop it from being too tall. However, this doesn't happen and it continues to fill. It's also invisible when empty. I have searched google and stackoverflow to no avail. Can someone help me understand why my css styles aren't working?
PS: The javascript is just there so it doesn't reload when you click the send button
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
html css
html css
edited Nov 9 at 21:57
lgwilliams
296313
296313
asked Nov 9 at 19:00
Electrox Mortem
14713
14713
Since you're using percentages, you have to make sure that the html/body tags also have a width and height of 100%.
– Jacques
Nov 9 at 19:03
ok whatever. Wait a minute, did you honestly just comment on my question so that you could reply to me?
– Electrox Mortem
Nov 10 at 4:48
@DaveNewton Also, it's listed in my developer story that I'm a mean person.
– Electrox Mortem
Nov 10 at 4:50
@DaveNewton For the intentions of the question that was asked, it seemed to be quite incorrect. Expecially since they were asking for a function calledreduce
, which according to the underline.js docs, was a function for arrays only. What's anFWIW
???
– Electrox Mortem
Nov 10 at 5:16
Hm. Ok. Goodnight
– Electrox Mortem
Nov 10 at 5:27
add a comment |
Since you're using percentages, you have to make sure that the html/body tags also have a width and height of 100%.
– Jacques
Nov 9 at 19:03
ok whatever. Wait a minute, did you honestly just comment on my question so that you could reply to me?
– Electrox Mortem
Nov 10 at 4:48
@DaveNewton Also, it's listed in my developer story that I'm a mean person.
– Electrox Mortem
Nov 10 at 4:50
@DaveNewton For the intentions of the question that was asked, it seemed to be quite incorrect. Expecially since they were asking for a function calledreduce
, which according to the underline.js docs, was a function for arrays only. What's anFWIW
???
– Electrox Mortem
Nov 10 at 5:16
Hm. Ok. Goodnight
– Electrox Mortem
Nov 10 at 5:27
Since you're using percentages, you have to make sure that the html/body tags also have a width and height of 100%.
– Jacques
Nov 9 at 19:03
Since you're using percentages, you have to make sure that the html/body tags also have a width and height of 100%.
– Jacques
Nov 9 at 19:03
ok whatever. Wait a minute, did you honestly just comment on my question so that you could reply to me?
– Electrox Mortem
Nov 10 at 4:48
ok whatever. Wait a minute, did you honestly just comment on my question so that you could reply to me?
– Electrox Mortem
Nov 10 at 4:48
@DaveNewton Also, it's listed in my developer story that I'm a mean person.
– Electrox Mortem
Nov 10 at 4:50
@DaveNewton Also, it's listed in my developer story that I'm a mean person.
– Electrox Mortem
Nov 10 at 4:50
@DaveNewton For the intentions of the question that was asked, it seemed to be quite incorrect. Expecially since they were asking for a function called
reduce
, which according to the underline.js docs, was a function for arrays only. What's an FWIW
???– Electrox Mortem
Nov 10 at 5:16
@DaveNewton For the intentions of the question that was asked, it seemed to be quite incorrect. Expecially since they were asking for a function called
reduce
, which according to the underline.js docs, was a function for arrays only. What's an FWIW
???– Electrox Mortem
Nov 10 at 5:16
Hm. Ok. Goodnight
– Electrox Mortem
Nov 10 at 5:27
Hm. Ok. Goodnight
– Electrox Mortem
Nov 10 at 5:27
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Probably you didn't define this:
html, body
height: 100%;
And the same for any other element between body
and #chat
- the 100% height need a reference.
Without that, that DIV is only as high as it's content, so if there is no content, it will remain invisible....
Whymst does yu keep editting my stuff and not telling me what it is you did?!?!
– Electrox Mortem
Nov 9 at 19:18
@JermahlWhite If you click the "Edited X mins ago" above the editor's name, it shows you a diff of the of the changes.
– Tyler Roper
Nov 9 at 19:21
Oh. oof. Thanks for telling me this
– Electrox Mortem
Nov 9 at 19:23
add a comment |
up vote
0
down vote
Body looks to its parent (HTML) for how to scale the dynamic property, so the HTML element needs to have its height set as well.
However, the content of body will probably need to change dynamically. Setting height to 100% will accomplish your goal.
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
html, body
height:100%;
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Probably you didn't define this:
html, body
height: 100%;
And the same for any other element between body
and #chat
- the 100% height need a reference.
Without that, that DIV is only as high as it's content, so if there is no content, it will remain invisible....
Whymst does yu keep editting my stuff and not telling me what it is you did?!?!
– Electrox Mortem
Nov 9 at 19:18
@JermahlWhite If you click the "Edited X mins ago" above the editor's name, it shows you a diff of the of the changes.
– Tyler Roper
Nov 9 at 19:21
Oh. oof. Thanks for telling me this
– Electrox Mortem
Nov 9 at 19:23
add a comment |
up vote
2
down vote
accepted
Probably you didn't define this:
html, body
height: 100%;
And the same for any other element between body
and #chat
- the 100% height need a reference.
Without that, that DIV is only as high as it's content, so if there is no content, it will remain invisible....
Whymst does yu keep editting my stuff and not telling me what it is you did?!?!
– Electrox Mortem
Nov 9 at 19:18
@JermahlWhite If you click the "Edited X mins ago" above the editor's name, it shows you a diff of the of the changes.
– Tyler Roper
Nov 9 at 19:21
Oh. oof. Thanks for telling me this
– Electrox Mortem
Nov 9 at 19:23
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Probably you didn't define this:
html, body
height: 100%;
And the same for any other element between body
and #chat
- the 100% height need a reference.
Without that, that DIV is only as high as it's content, so if there is no content, it will remain invisible....
Probably you didn't define this:
html, body
height: 100%;
And the same for any other element between body
and #chat
- the 100% height need a reference.
Without that, that DIV is only as high as it's content, so if there is no content, it will remain invisible....
edited Nov 9 at 19:16
answered Nov 9 at 19:03
Johannes
36.1k92764
36.1k92764
Whymst does yu keep editting my stuff and not telling me what it is you did?!?!
– Electrox Mortem
Nov 9 at 19:18
@JermahlWhite If you click the "Edited X mins ago" above the editor's name, it shows you a diff of the of the changes.
– Tyler Roper
Nov 9 at 19:21
Oh. oof. Thanks for telling me this
– Electrox Mortem
Nov 9 at 19:23
add a comment |
Whymst does yu keep editting my stuff and not telling me what it is you did?!?!
– Electrox Mortem
Nov 9 at 19:18
@JermahlWhite If you click the "Edited X mins ago" above the editor's name, it shows you a diff of the of the changes.
– Tyler Roper
Nov 9 at 19:21
Oh. oof. Thanks for telling me this
– Electrox Mortem
Nov 9 at 19:23
Whymst does yu keep editting my stuff and not telling me what it is you did?!?!
– Electrox Mortem
Nov 9 at 19:18
Whymst does yu keep editting my stuff and not telling me what it is you did?!?!
– Electrox Mortem
Nov 9 at 19:18
@JermahlWhite If you click the "Edited X mins ago" above the editor's name, it shows you a diff of the of the changes.
– Tyler Roper
Nov 9 at 19:21
@JermahlWhite If you click the "Edited X mins ago" above the editor's name, it shows you a diff of the of the changes.
– Tyler Roper
Nov 9 at 19:21
Oh. oof. Thanks for telling me this
– Electrox Mortem
Nov 9 at 19:23
Oh. oof. Thanks for telling me this
– Electrox Mortem
Nov 9 at 19:23
add a comment |
up vote
0
down vote
Body looks to its parent (HTML) for how to scale the dynamic property, so the HTML element needs to have its height set as well.
However, the content of body will probably need to change dynamically. Setting height to 100% will accomplish your goal.
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
html, body
height:100%;
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
add a comment |
up vote
0
down vote
Body looks to its parent (HTML) for how to scale the dynamic property, so the HTML element needs to have its height set as well.
However, the content of body will probably need to change dynamically. Setting height to 100% will accomplish your goal.
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
html, body
height:100%;
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
add a comment |
up vote
0
down vote
up vote
0
down vote
Body looks to its parent (HTML) for how to scale the dynamic property, so the HTML element needs to have its height set as well.
However, the content of body will probably need to change dynamically. Setting height to 100% will accomplish your goal.
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
html, body
height:100%;
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
Body looks to its parent (HTML) for how to scale the dynamic property, so the HTML element needs to have its height set as well.
However, the content of body will probably need to change dynamically. Setting height to 100% will accomplish your goal.
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
html, body
height:100%;
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
html, body
height:100%;
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
chatForm.addEventListener('submit', function(e)
e.preventDefault()
//sends message
);
html, body
height:100%;
#chat
width:100%;
height:100%;
#messagebox
border: 0;
padding: 10px;
width: 90%;
height:10%;
margin:0;
float:left;
.submitButton
padding:10px;
width: 10%;
height:10%;
background: #003;
float:right;
border:0;
color:white;
cursor: pointer;
.submitButton:hover
background:#033
#messages
width:100%;
height:90%;
margin:0;
overflow:auto;
#messages p
padding: 5px 10px;
background: lightblue;
color:white;
#messages p:nth-child(odd)
background: white;
color:lightblue;
#messages p .deleteButton
background: white;
color:lightblue;
#messages p:nth-child(odd) .deleteButton
background: lightblue;
color:white;
<div id="chat">
<div id="messages">
<p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p><p>Example Message</p>
</div>
<form id="chatForm">
<input id="messagebox" required/>
<button class="submitButton">
Send
</button>
</form>
</div>
answered Nov 9 at 19:16
Michal
2,0491135
2,0491135
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53231819%2fempty-div-is-invisible%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Since you're using percentages, you have to make sure that the html/body tags also have a width and height of 100%.
– Jacques
Nov 9 at 19:03
ok whatever. Wait a minute, did you honestly just comment on my question so that you could reply to me?
– Electrox Mortem
Nov 10 at 4:48
@DaveNewton Also, it's listed in my developer story that I'm a mean person.
– Electrox Mortem
Nov 10 at 4:50
@DaveNewton For the intentions of the question that was asked, it seemed to be quite incorrect. Expecially since they were asking for a function called
reduce
, which according to the underline.js docs, was a function for arrays only. What's anFWIW
???– Electrox Mortem
Nov 10 at 5:16
Hm. Ok. Goodnight
– Electrox Mortem
Nov 10 at 5:27