css - Fix gap from border-bottom none -


i have <a> tag border: 1px solid #ccc; border-bottom:none; style , it's leaves tiny gap, please @ codepen result see mean. gap appears left login tab if login tab active or right register tab if register tab active.

html:

<div id="w-login">     <div id="login">         <menu id="tabs"> <a id="tab-signin" class="tab-active"><i class="fa fa-unlock-alt"></i>login</a><a id="tab-signup"><i class="fa fa-lock"></i>register</a>          </menu>         <div id="signin">             <form class="form-horizontal">                 <div class="form-group">                     <label for="username" class="control-label col-1">username:</label>                     <input type="text" name="username" class="form-control col-2" id="si-username">                 </div>                 <div class="form-group">                     <label for="password" class="control-label col-1">password:</label>                     <input type="password" name="password" class="form-control col-2" id="si-password">                 </div>                 <input type="submit" value="login" class="btn btn-primary" id="si-submit">             </form>         </div>         <div id="signup">             <form class="form-horizontal">                 <div class="form-group">                     <label for="username" class="control-label col-1">username:</label>                     <input type="text" name="username" class="form-control col-2" id="su-username">                 </div>                 <div class="form-group">                     <label for="password" class="control-label col-1">password:</label>                     <input type="password" name="password" class="form-control col-2" id="su-password">                 </div>                 <div class="form-group">                     <label for="email" class="control-label col-1">email:</label>                     <input type="text" name="email" class="form-control col-2" id="su-email">                 </div>                 <input type="submit" value="register" class="btn btn-primary" id="su-submit">             </form>         </div>     </div> </div> 

css:

#container {     height: 100%;     width: 100%;     text-align: center;     font-size: 14px; } #container:before {     content:'';     display: inline-block;     height: 100%;     vertical-align: middle;     margin-right: -3px; } #w-login {     display: inline-block;     vertical-align: middle;     width: 40%;     padding: 5px; } #login { } #signin, #signup {     border: 1px solid #ccc;     border-top: none;     padding: 20px 10px;     border-bottom-left-radius: 15px;     -webkit-border-bottom-left-radius: 15px;     -moz-border-bottom-left-radius: 15px;     border-bottom-right-radius: 15px;     -webkit-border-bottom-right-radius: 15px;     -moz-border-bottom-right-radius: 15px; } #signup {     display: none; } #tabs {     padding: 0;     margin: 0;     border: 1px solid #ccc;     border-top-left-radius: 15px;     -webkit-border-top-left-radius: 15px;     -moz-border-top-left-radius: 15px;     border-top-right-radius: 15px;     -webkit-border-top-right-radius: 15px;     -moz-border-top-right-radius: 15px;     border-bottom: none; } #tabs {     padding: 10px 0;     display: inline-block;     width: 50%;     cursor: pointer;     text-decoration: none; } #tabs .tab-active { } #tab-signin.tab-active {     border: 1px solid #ccc;     border-width: 0 1px 1px 0; } #tab-signup.tab-active {     border: 1px solid #ccc;     border-width: 0 0 1px 1px; } .col-1 {     width: 28%; } .col-2 {     width: 70%;     display: inline-block; } .form-horizontal .form-group {     margin-right: 0;     margin-left: 0; } .btn {     width: 99%; } .fa {     padding-right: 5px; } 

note: rest of css styles come bootstrap

js/jquery:

$(function(){     $('#tab-signin').click(function(){        $('#signup').hide();         $('#signin').show();        switchtab();     });     $('#tab-signup').click(function(){        $('#signin').hide();         $('#signup').show();        switchtab();     }); });  function switchtab(){     $('#tabs a').toggleclass('tab-active'); } 

i suggest following approach.

i take advantage of fact in mark-up 2 tab elements, #tab-signin , #tab-signup, children of menu#tabs element.

that being case, place left, top , right borders on #tabs element , remove left/top , top/right borders on 2 children elements (#tab-signin , #tab-signup respectively).

the css #tabs like:

#tabs{     padding: 0;     margin: 0;     border: 1px solid #ccc;     border-top-left-radius: 15px;     -webkit-border-top-left-radius: 15px;     -moz-border-top-left-radius: 15px;     border-top-right-radius: 15px;     -webkit-border-top-right-radius: 15px;     -moz-border-top-right-radius: 15px;     border-bottom: none; } 

to style .tab-active cases, create 2 specific rules sign-in , sign-up tabs, right/bottom , bottom/left borders respectively:

#tabs .tab-active{ }  #tab-signin.tab-active{     border: 1px solid #ccc;     border-width: 0 1px 1px 0; }  #tab-signup.tab-active{     border: 1px solid #ccc;     border-width: 0 0 1px 1px; } 

see demo at: http://jsfiddle.net/audetwebdesign/by4g5/

the problem noticed earlier not browser bug. css specification not specify how browsers draw corners of borders (the joints), @ mercy of browser particular design detail.

my approach avoid problem taking full advantage of html mark-up in code.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -