JavaScript How to ensure that elements are properly aligned even when window is resized?

Change the width of your textarea to 600px to fill the entire centered #chatArea div and center your h1 by changing its margins to:

margin-left: auto;
margin-right: auto;

Full code:

<html>
<head>
<style type='text/css'>
  textarea {
    height:500px;
    width:600px;
    font-size:20;
    font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
  }
  input[type="text"] {
    width: 450px;
    height: 30px;
  }
  #chatArea {
    width:600px;
    margin: 10px auto;
  }
  h1
  {
    text-align: center;
    width:600px;
    margin-left: auto;
    margin-right: auto;
    color: brown;
  }
  .greyText
  {
    color:grey;
  }
</style>
</head>

<body>
<h1>Suggestion Box</h1>
<div id="chatArea">
<textarea id='chatHistory' value="Type your suggestion here." ></textarea>
<br/><br/>
<form id= 'chatForm' onsubmit="return false">
    <input name= 'newMessageString' id="newMessageString" type="text" />
    <input type="submit" value='send'/>
</form>
</div>
</body>
</html>
Answer:1

Here is the code :

<html><head>
<style type="text/css">
  textarea {
    height:500px;
    width:500px;
    font-size:20;
    font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
  }
  input[type="text"] {
    width: 450px;
    height: 30px;
  }
  #chatArea {
    text-align:center;
    width:600px;
    margin: 10px auto;
  }
  h1
  {
    text-align: center;
    color: brown;
  }
  .greyText
  {
    color:grey;
  }
</style>
</head>

<body cz-shortcut-listen="true">

<div id="chatArea">
<h1>Suggestion Box</h1><textarea id="chatHistory" value="Type your suggestion here."></textarea>
<br><br>
<form id="chatForm" onsubmit="return false">
    <input name="newMessageString" id="newMessageString" type="text">
    <input type="submit" value="send">
</form>
</div>

`</body></html>
Answer:2

you can use percentages to acomodate your layout on the browser take a look at the changes i made http://coding.smashingmagazine.com/2009/06/09/smart-fixes-for-fluid-layouts/

 <style type='text/css'>
              textarea {
                height:500px;
                width:500px;
                font-size:20;
                font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
              }
              input[type="text"] {
                width: 450px;
                height: 30px;
              }
              #chatArea {
                width:80%;
                margin: 10px auto;
                display:block;
                text-align:center;
              }
              h1
              {
                text-align: center;
                width:80%;
                margin-left:auto;
                margin-right:auto;
                color: brown;
              }
              .greyText
              {
                color:grey;
              }
            </style>
Answer:3

function Class () { var self = this; this.hi = true; // this { hi: true }, self { hi: true } self.hi = false; // this { hi: false }, self { hi: false } } Why doesn't self behave like a normal var?

function Class () { var self = this; this.hi = true; // this { hi: true }, self { hi: true } self.hi = false; // this { hi: false }, self { hi: false } } Why doesn't self behave like a normal var?

I have a web form, with text inputs for crontab values (minutes/hours/months/days), and I want to display user the next date of selected crontab task execution. For example, i have a values 20 15 15 *...

I have a web form, with text inputs for crontab values (minutes/hours/months/days), and I want to display user the next date of selected crontab task execution. For example, i have a values 20 15 15 *...

I want to set the selected value of a jQuery Mobile flipswitch: <select id="quote" data-role="flipswitch" data-theme="b"> <option value="nee">Nee</option> <option value="...

I want to set the selected value of a jQuery Mobile flipswitch: <select id="quote" data-role="flipswitch" data-theme="b"> <option value="nee">Nee</option> <option value="...

  1. cannot call methods on dialog prior to initialization
  2. cannot call methods on a stopped sparkcontext
  3. cannot call methods on varchar
  4. cannot call methods on nvarchar
  5. cannot call methods on int
  6. cannot call methods on nvarchar(max)
  7. cannot call methods on date
  8. cannot call methods on button prior to initialization
  9. cannot call methods on autocomplete prior to initialization
  10. cannot call methods on varchar(max)
  11. cannot call methods on bigint
  12. cannot call methods on varchar. sql
  13. cannot call methods on ntext
  14. cannot call methods on float
  15. cannot call methods on tooltip prior to initialization
  16. cannot call methods on tabs prior to initialization
  17. cannot call methods on draggable prior to initialization
  18. cannot call methods on decimal
  19. cannot call methods on sortable prior to initialization
  20. cannot call methods on slider prior to initialization

I have a question about selecting parts of a JSON object and check if they have a value or not. I load the JSON from an API in PHP: $json_url ='http://api.url.com/api/gateway/call/1.4/getApp?appid=...

I have a question about selecting parts of a JSON object and check if they have a value or not. I load the JSON from an API in PHP: $json_url ='http://api.url.com/api/gateway/call/1.4/getApp?appid=...