javascript - Let <div> grow if <p contenteditable> grows -


how can move elements below paragraph p, contenteditable, when type something.

here code:

body,  html {    margin: 0;    padding: 0;    background-color: white;  }  .input {    border: 1px dotted black;    width: 30%;    float: right;    left: 45%;    height: 40px;    position: absolute;    background-color: #8ce1ff;    color: #6e6e6e;    font-size: 16px;    font-family: 'arimo';  }  .input:hover {    border: 1px solid black;  }  #content {    border: 1px dotted black;    width: 50%;    float: right;    position: absolute;    background-color: #8ce1ff;    color: #6e6e6e;    font-size: 19px;    font-family: 'arimo';    height: 40%;  }  #content:hover {    border: 1px solid black;  }  .details {    margin-bottom: 30px;    z-index: 900;    font-family: 'arimo';    font-size: 17px;  }  section {    background-color: #53cffc;    margin: 20%;    z-index: 901;    border: 1px solid black;  }  #button {    color: #c0c0c0;    margin-top: 5%;    background: #168cb7;    border: 1px solid #0c8fbf;    height: 40px;    width: 100%;    font-family: 'arimo';    font-size: 20px;    position: relative;  }  #title {    height: 40px;    text-align: center;    font-family: 'arimo';    font-size: 20px;    background: #168cb7;    color: #c0c0c0;  }  #form {    padding: 4%;  }
<section>    <div id="title">title</div>    <div id="form">      <div class="details">name <strong>*</strong>:        <input type="text" class="input" id="name">        <br>      </div>      <div class="details">mail <strong>*</strong> :        <input type="text" class="input" id="mail">        <br>      </div>      <div class="details">website:        <input type="text" class="input" id="name">        <br>      </div>      <br>      <div class="details">        text:        <p id="content" contenteditable="true">click write post.</p>        <br>      </div>    </div>    <button id="button" onclick="">submit</button>  </section>

here jsfiddle

  • add word-wrap: break-word #content
  • change position:absolute relative in #content

body {    margin: 0;    }  .input {    border: 1px dotted black;    width: 30%;    float: right;    left: 45%;    height: 40px;    position: absolute;    background-color: #8ce1ff;    color: #6e6e6e;    font-size: 16px;    font-family: 'arimo';  }  .input:hover {    border: 1px solid black;  }  #content {    border: 1px dotted black;    width: 100%;    float: right;    position: relative;    background-color: #8ce1ff;    color: #6e6e6e;    font-size: 19px;    font-family: 'arimo';    height: 40%;    word-wrap: break-word  }  #content:hover {    border: 1px solid black;  }  .details {    margin-bottom: 30px;    z-index: 900;    font-family: 'arimo';    font-size: 17px;  }  section {    background-color: #53cffc;    margin: 20%;    z-index: 901;    border: 1px solid black;  }  #button {    color: #c0c0c0;    margin-top: 5%;    background: #168cb7;    border: 1px solid #0c8fbf;    height: 40px;    width: 100%;    font-family: 'arimo';    font-size: 20px;    position: relative;  }  #title {    height: 40px;    text-align: center;    font-family: 'arimo';    font-size: 20px;    background: #168cb7;    color: #c0c0c0;  }  #form {    padding: 4%;  }
<section>    <div id="title">title</div>      <div id="form">        <div class="details">name <strong>*</strong>:        <input type="text" class="input" id="name">        <br>      </div>      <div class="details">mail <strong>*</strong> :        <input type="text" class="input" id="mail">        <br>      </div>      <div class="details">website:        <input type="text" class="input" id="name">        <br>      </div>        <br>      <div class="details">text:        <p id="content" contenteditable="true">click write post.</p>        <br>      </div>      </div>        <button id="button" onclick="">submit</button>  </section>


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -