1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Strange issue with checkbox - HTML5

Discussion in 'HTML & Website Design' started by Orawolf, Nov 30, 2015.

  1. #1
    Hello,
    This is on HTML5. Please check and run following HTML code. You will see that the check box leaves yellow padding that precedes the checkbox itself and also it leaves trailing yellow padding. Not sure which CSS property is causing this. I think the div ID "steps" and its CSS is causing the issue. But I must have those settings. How can I just show a normal looking checkbox? Please see the attached image of the issue.

    HTML Code:
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
    <meta charset="utf-8">
    <title>Bootstrap, from Twitter</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="" name="description">
    <meta content="" name="author">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <meta content="width=device-width;
          height=device-height;
          initial-scale=1" name="viewport">
    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="css/sliders.css" rel="stylesheet" type="text/css">
    <link href="css/jaqmain.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    html, body {
        background-color: white;
        color: black;
        font: 100%/1.5 sans-serif;
        height: 100%;
        margin: 0;
        padding: 0;
        position: relative;
    }
    p {
        font-size: 1em;
    }
    div.cell-holder {
        display: table;
        width: 100%;
        height: 100%;
    }
    div.tnails {
        ,    display: table-cell;
        text-align: center;
        vertical-align: middle;
    }
    img {
        /* border is for clarity
              border: 1px solid blue;*/
        display: inline-block;
    }
    /*Following styles are for form sliders */
    span.reference {
        position: fixed;
        left: 5px;
        top: 5px;
        font-size: 10px;
        text-shadow: 1px 1px 1px #fff;
    }
    span.reference a {
        color: #555;
        text-decoration: none;
        text-transform: uppercase;
    }
    span.reference a:hover {
        color: #000;
    }
    h1 {
        color: #ccc;
        font-size: 36px;
        text-shadow: 1px 1px 1px #fff;
        padding: 20px;
    }
    </style>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/sliders.js" type="text/javascript"> </script>
    </head>
    
    <body>
    
    
    <div id="content">
        <div id="wrapper">
            <div id="steps">
                <form id="formElem" action="" method="post" name="formElem">
                    <!-- SECOND TAB-->
                    <fieldset class="step">
                    <legend>select your interests</legend>
                    <input id="acheck" name="acheck" type="checkbox"/>asaa    </fieldset>
                    <!-->
                    <!-->
                    <!-->
                    <!-->
                </form>
            </div>
    </div>
    </div>
    </body>
    
    </html>
    
    HTML:
    CSS Code
    *{
        margin:0px;
        padding:0px;
    }
    body{
        color:#444444;
        font-size:13px;
        background: #f2f2f2;
        font-family:"Century Gothic", Helvetica, sans-serif;
    }
    #content{
        margin:15px auto;
        text-align:center;
        width:600px;
        position:relative;
        height:100%;
    }
    #wrapper{
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
        -moz-border-radius:10px;
        -webkit-border-radius:10px;
        border-radius:10px;
        border:2px solid #fff;
        background-color:#f9f9f9;
        width:600px;
        overflow:hidden;
    }
    #steps{
        width:600px;
        /*height:320px;*/
       overflow:hidden;
    }
    .step{
        float:left;
        width:600px;
        /*height:320px;*/
    }
    #navigation{
        height:45px;
        background-color:#e9e9e9;
        border-top:1px solid #fff;
        -moz-border-radius:0px 0px 10px 10px;
        -webkit-border-bottom-left-radius:10px;
        -webkit-border-bottom-right-radius:10px;
        border-bottom-left-radius:10px;
        border-bottom-right-radius:10px;
    }
    #navigation ul{
        list-style:none;
        float:left;
        margin-left:22px;
    }
    #navigation ul li{
        float:left;
        border-right:1px solid #ccc;
        border-left:1px solid #ccc;
        position:relative;
        margin:0px 2px;
    }
    #navigation ul li a{
        display:block;
        height:45px;
        background-color:#444;
        color:#777;
        outline:none;
        font-weight:bold;
        text-decoration:none;
        line-height:45px;
        padding:0px 20px;
        border-right:1px solid #fff;
        border-left:1px solid #fff;
        background:#f0f0f0;
        background:
            -webkit-gradient(
            linear,
            left bottom,
            left top,
            color-stop(0.09, rgb(240,240,240)),
            color-stop(0.55, rgb(227,227,227)),
            color-stop(0.78, rgb(240,240,240))
            );
        background:
            -moz-linear-gradient(
            center bottom,
            rgb(240,240,240) 9%,
            rgb(227,227,227) 55%,
            rgb(240,240,240) 78%
            )
    }
    #navigation ul li a:hover,
    #navigation ul li.selected a{
        background:#d8d8d8;
        color:#666;
        text-shadow:1px 1px 1px #fff;
    }
    span.checked{
        background:transparent url(../images/checked.png) no-repeat top left;
        position:absolute;
        top:0px;
        left:1px;
        width:20px;
        height:20px;
    }
    span.error{
        background:transparent url(../images/error.png) no-repeat top left;
        position:absolute;
        top:0px;
        left:1px;
        width:20px;
        height:20px;
    }
    #steps form fieldset{
        border:none;
        padding-bottom:20px;
    }
    #steps form legend{
        text-align:left;
        background-color:#f0f0f0;
        color:#666;
        font-size:24px;
        text-shadow:1px 1px 1px #fff;
        font-weight:bold;
        float:left;
        width:590px;
        padding:5px 0px 5px 10px;
        margin:10px 0px;
        border-bottom:1px solid #fff;
        border-top:1px solid #d9d9d9;
    }
    #steps form p{
        float:left;
        clear:both;
        margin:5px 0px;
        background-color:#f4f4f4;
        border:1px solid #fff;
        width:400px;
        padding:10px;
        margin-left:100px;
        -moz-border-radius: 5px;
        -webkit-border-radius: 5px;
        border-radius: 5px;
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
    }
    #steps form p label{
        width:160px;
        float:left;
        text-align:right;
        margin-right:15px;
        line-height:26px;
        color:#666;
        text-shadow:1px 1px 1px #fff;
        font-weight:bold;
    }
    #steps form input:not([type=radio]),
    #steps form textarea,
    #steps form select{
        background: #ffffff;
        border: 1px solid #ddd;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        outline: none;
        padding: 5px;
        width: 200px;
        float:left;
    }
    #steps form input:focus{
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
        background-color:#FFFEEF;
    }
    #steps form p.submit{
        background:none;
        border:none;
        -moz-box-shadow:none;
        -webkit-box-shadow:none;
        box-shadow:none;
    }
    #steps form button {
        border:none;
        outline:none;
        -moz-border-radius: 10px;
        -webkit-border-radius: 10px;
        border-radius: 10px;
        color: #ffffff;
        display: block;
        cursor:pointer;
        margin: 0px auto;
        clear:both;
        padding: 7px 25px;
        text-shadow: 0 1px 1px #777;
        font-weight:bold;
        font-family:"Century Gothic", Helvetica, sans-serif;
        font-size:22px;
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
        background:#4797ED;
    }
    #steps form button:hover {
        background:#d8d8d8;
        color:#666;
        text-shadow:1px 1px 1px #fff;
    }
    Code (CSS):

     

    Attached Files:

    Orawolf, Nov 30, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You have a set width on input. Add a :not([type=checkbox]) to the rule?
     
    PoPSiCLe, Dec 1, 2015 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Yeah, generally speaking widths and form elements are a BAD idea, particularly checkboxes or radio buttons.

    P.S. Get a <label> in there!
     
    deathshadow, Dec 1, 2015 IP
  4. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #4
    Your problem was this focus:

    
    #steps form input:focus{
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
        background-color:#FFFEEF;
    }
    
    Code (markup):
    Removing the shadow did the trick:

    http://jsfiddle.net/07ygfvgg/7/

    I also made the text show next to the checkbox. Not sure what you mean by the yellow trail. I don't see any.

    The css:

    
    *{
        margin:0px;
        padding:0px;
    }
    body{
        color:#444444;
        font-size:13px;
        background: #f2f2f2;
        font-family:"Century Gothic", Helvetica, sans-serif;
    }
    #content{
        margin:15px auto;
        width:600px;
        height:100%;
    }
    #wrapper{
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
        -moz-border-radius:10px;
        -webkit-border-radius:10px;
        border-radius:10px;
        border:2px solid #fff;
        background-color:#f9f9f9;
        width:600px;
        overflow:hidden;
    }
    #steps{
        width:600px;
        /*height:320px;*/
       overflow:hidden;
    }
    .step{
        float:left;
        width:600px;
        /*height:320px;*/
    }
    #navigation{
        height:45px;
        background-color:#e9e9e9;
        border-top:1px solid #fff;
        -moz-border-radius:0px 0px 10px 10px;
        -webkit-border-bottom-left-radius:10px;
        -webkit-border-bottom-right-radius:10px;
        border-bottom-left-radius:10px;
        border-bottom-right-radius:10px;
    }
    #navigation ul{
        list-style:none;
        float:left;
        margin-left:22px;
    }
    #navigation ul li{
        float:left;
        border-right:1px solid #ccc;
        border-left:1px solid #ccc;
        position:relative;
        margin:0px 2px;
    }
    #navigation ul li a{
        display:block;
        height:45px;
        background-color:#444;
        color:#777;
        outline:none;
        font-weight:bold;
        text-decoration:none;
        line-height:45px;
        padding:0px 20px;
        border-right:1px solid #fff;
        border-left:1px solid #fff;
        background:#f0f0f0;
        background:
            -webkit-gradient(
            linear,
            left bottom,
            left top,
            color-stop(0.09, rgb(240,240,240)),
            color-stop(0.55, rgb(227,227,227)),
            color-stop(0.78, rgb(240,240,240))
            );
        background:
            -moz-linear-gradient(
            center bottom,
            rgb(240,240,240) 9%,
            rgb(227,227,227) 55%,
            rgb(240,240,240) 78%
            )
    }
    #navigation ul li a:hover,
    #navigation ul li.selected a{
        background:#d8d8d8;
        color:#666;
        text-shadow:1px 1px 1px #fff;
    }
    span.checked{
        background:transparent url(../images/checked.png) no-repeat top left;
        position:absolute;
        top:0px;
        left:1px;
        width:20px;
        height:20px;
    }
    span.error{
        background:transparent url(../images/error.png) no-repeat top left;
        position:absolute;
        top:0px;
        left:1px;
        width:20px;
        height:20px;
    }
    #steps form fieldset{
        border:none;
        padding-bottom:20px;
    }
    #steps form legend{
        text-align:left;
        background-color:#f0f0f0;
        color:#666;
        font-size:24px;
        text-shadow:1px 1px 1px #fff;
        font-weight:bold;
        float:left;
        width:590px;
        padding:5px 0px 5px 10px;
        margin:10px 0px;
        border-bottom:1px solid #fff;
        border-top:1px solid #d9d9d9;
    }
    #steps form p{
        float:left;
        clear:both;
        margin:5px 0px;
        background-color:#f4f4f4;
        border:1px solid #fff;
        width:400px;
        padding:10px;
        margin-left:100px;
        -moz-border-radius: 5px;
        -webkit-border-radius: 5px;
        border-radius: 5px;
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
    }
    #steps form p label{
        width:160px;
       float:left;
       text-align:right;
        margin-right:15px;
        line-height:26px;
        color:#666;
        text-shadow:1px 1px 1px #fff;
        font-weight:bold;
    }
    #steps form input:not([type=radio]),
    #steps form textarea,
    #steps form select{
        background: #ffffff;
        border: 1px solid #ddd;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        outline: none;
        margin: 5px 0px 0px 0px;
        padding: 5px;
        width: 50px;
        float:left;
    }
    #steps form input:focus{
        background-color:#FFFEEF;
    }
    #steps form p.submit{
        background:none;
        border:none;
        -moz-box-shadow:none;
        -webkit-box-shadow:none;
        box-shadow:none;
    }
    #steps form button {
        border:none;
        outline:none;
        -moz-border-radius: 10px;
        -webkit-border-radius: 10px;
        border-radius: 10px;
        color: #ffffff;
        display: block;
        cursor:pointer;
        margin: 0px auto;
        clear:both;
        padding: 7px 25px;
        text-shadow: 0 1px 1px #777;
        font-weight:bold;
        font-family:"Century Gothic", Helvetica, sans-serif;
        font-size:22px;
        -moz-box-shadow:0px 0px 3px #aaa;
        -webkit-box-shadow:0px 0px 3px #aaa;
        box-shadow:0px 0px 3px #aaa;
        background:#4797ED;
    }
    #steps form button:hover {
        background:#d8d8d8;
        color:#666;
        text-shadow:1px 1px 1px #fff;
    }
    
    Code (markup):
     
    qwikad.com, Dec 1, 2015 IP