php - Page jumps to the top when checkbox is clicked css -


i have html page have created small looking button display instead of checkbox

div label input {    margin-right: 100px;  }    body {    font-family: sans-serif;  }    #ck-button {    margin: 4px;    background-color: #efefef;    border-radius: 4px;    border: 1px solid #d0d0d0;    overflow: auto;    float: left;  }    #ck-button:hover {    background: red;  }    #ck-button label {    float: left;    width: 4.0em;  }    #ck-button label span {    text-align: center;    padding: 3px 0px;    display: block;  }    #ck-button label input {    position: absolute;    top: -20px;  }    #ck-button input:checked+span {    background-color: #911;    color: #fff;  }
<div id="ck-button">    <label>            <input type="checkbox" value="1"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div id="ck-button">    <label>            <input type="checkbox" value="2"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div id="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div id="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div id="ck-button">    <label>            <input type="checkbox" value="1"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div id="ck-button">    <label>            <input type="checkbox" value="2"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div id="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div id="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div id="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div id="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div id="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div id="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>

1) id must unique,you use #ck-button more of 1 element.use of class instead of id.

2) insert position: relative; parent of input.top:-20px; must measured relative label no body.

.ck-button label {   position: relative;<---------------added   //more codes .... } 

div label input {    margin-right: 100px;  }    body {    font-family: sans-serif;  }    .ck-button {    margin: 4px;    background-color: #efefef;    border-radius: 4px;    border: 1px solid #d0d0d0;    overflow: auto;    float: left;  }    .ck-button:hover {    background: red;  }    .ck-button label {    float: left;    width: 4.0em;    position: relative;      }    .ck-button label span {    text-align: center;    padding: 3px 0px;    display: block;  }    .ck-button label input {    position: absolute;    top: -20px;  }    .ck-button input:checked+span {    background-color: #911;    color: #fff;  }
<div class="ck-button">    <label>            <input type="checkbox" value="1"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div class="ck-button">    <label>            <input type="checkbox" value="2"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div class="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div class="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div class="ck-button">    <label>            <input type="checkbox" value="1"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div class="ck-button">    <label>            <input type="checkbox" value="2"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div class="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div class="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div class="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div class="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>  <div class="ck-button">    <label>            <input type="checkbox" value="3"><span>reject</span>         </label>  </div>  <p>t long established fact reader distracted readable content of page when looking @ layout. point of using lorem ipsum has more-or-less normal distribution of letters, opposed using 'content here,    content here', making readable english. many desktop publishing packages , web page editors use lorem ipsum default model text, , search 'lorem ipsum' uncover many web sites still in infancy. various versions    have evolved on years, accident, on purpose (injected humour , like).</p>  <div class="ck-button">    <label>            <input type="checkbox" value="4"><span>reject</span>         </label>  </div>  <p>    contrary popular belief, lorem ipsum not random text. has roots in piece of classical latin literature 45 bc, making on 2000 years old. richard mcclintock, latin professor @ hampden-sydney college in virginia, looked    1 of more obscure latin words, consectetur, lorem ipsum passage, , going through cites of word in classical literature, discovered undoubtable source. lorem ipsum comes sections 1.10.32 , 1.10.33 of "de finibus bonorum    et malorum" (the extremes of , evil) cicero, written in 45 bc. book treatise on theory of ethics, popular during renaissance. first line of lorem ipsum, "lorem ipsum dolor sit amet..", comes line in section    1.10.32. standard chunk of lorem ipsum used since 1500s reproduced below interested. sections 1.10.32 , 1.10.33 "de finibus bonorum et malorum" cicero reproduced in exact original form, accompanied english    versions 1914 translation h. rackham.  </p>


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -