边框右侧未显示

27

请问您知道为什么我的表单右侧没有显示蓝色边框吗?(该表单宽度为100%)非常感谢 http://jsfiddle.net/KtEdG/

在此输入图片描述 CSS:

.wrapper {
    position: relative;
    display: block;
    margin-right: auto;
    margin-left: auto;
    width: 1000px;
    overflow: hidden;

}


.block {    
    padding: 20px;
    background-clip: border-box;
    box-sizing: border-box;
    -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    overflow-x: hidden;


}

.block-left {
    float: left;
    box-sizing: border-box;
        overflow: hidden;

    width: 50%;

}
.block-right {
    float: right;
    overflow: hidden;
    box-sizing: border-box;
    width: 50%;


}

/*************************************************************
 * CONTACT
 *************************************************************/
.contact-form input[type=text] {
    float: left;
    width: 200px;
}
.contact-form input[type=email] {
    float: right;
    width: 200px;
}
.contact-form input[type=submit] {
    float: right;
    margin-top: 8px;
}
.contact-form textarea {
    float: left;
    margin-top: 20px;
    margin-bottom: 10px;
    width: 100%;
    height: 70px;
    overflow: auto;
}
/*************************************************************


/*************************************************************
 * FORMS
 *************************************************************/
form label {
    cursor: pointer;
}
form textarea, form input[type=text], form input[type=password], form input[type=email] {
    padding: 6px 8px;
    border-top: 1px solid transparent;
    border-right: 1px solid #d2d2d2;
    border-bottom: 1px solid transparent;
    border-left: 1px solid #d2d2d2;
    background: #d5d5d5 url('../images/form-bg.png') left top repeat-x;
    color: #7c7c7c;
    font-family: 'Arial', sans-serif;
    resize: none;
}
form input:focus, form textarea:focus {
    outline: none;
    border: 1px solid #0069BA;
    background: #d5d5d5 none;
}
form input[type=submit] {
    padding: 8px 50px;
    border: 0;
    background: #0064C4 url('../images/form-caret.png') right center no-repeat;
    color: #fff;
    text-transform: uppercase;
    font-weight: normal;
    font-size: 14px;
    font-family: 'Arial', sans-serif;
    cursor: pointer;
}



#addressbox {
    position: relative;
    padding: 10px 0px 0 10px;
    margin-bottom: 20px;
}
#addressbox p {

    line-height: 14px;
}
#contact li {
    display: inline;
    padding-right: 5px;
    color: #333;
    list-style: none;
    font-weight: 500;
    font-size: 13px;
}
#contact li a {
    border-bottom: none;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}

HTML

<div class="wrapper white-background">
            <div class="block">
          <div class="block-left">
            <div id="addressbox">
              <p><strong>fdsfsd</strong></p>
              <p>3, rudsfdser</p>
              <p> L53ddfsfurg)</p>
              <ul id="contact" class="ul-none">
                <li><i class="fa fa-phone blue"></i> +352 691 123.456</li>
                <li><i class="fa fa-envelope blue"></i> <a href="javascript:sendAnnotatedMailTo('contact','bfdfs','dfsf','Contact via blondiau.lu','')">contact@fdsfdssd.lu</a></li>
                <li><i class="fa fa-map-marker blue"></i><a href="http://goo.gl/I47" target="_blank"> Plan d'accès</a></li>
              </ul>

            <div class="contactarrow"><img src="images/contact-handwriting.png" alt="contact-handwriting" width="339" height="69"></div></div>
            <!-- End DIV addressbox --> 
                      </div>
          <!-- End DIV block-left -->

          <div class="block-right"> 
            <!-- CONTACT FORM-->
            <div class="contact-form">
              <form id="contactfrm" method="post" class="clearfix">
                <div class="clearfix">
                  <input id="name" name="name" placeholder="Nom" type="text" value="">
                  <input id="email" name="email" placeholder="Email" type="email" value="">
                </div>
                <textarea id="message" name="message" placeholder="Votre message et vos coordonnées"></textarea>
                <input type="submit" value="Envoyer" name="submit">
                <p class="success" style="display:none">Votre message a bien été envoyé! Merci</p>
                <p class="error" style="display:none;">E-mail non valide et/ou message vide</p>
              </form>
            </div>
            <!-- /.contact-form --> 

2
请问您能否删除无关的CSS规则和HTML代码?这些代码让人很难阅读。 - JJJ
2个回答

20
由于您的

非常感谢。我喜欢演示2。但是你知道为什么现在电子邮件字段的右侧与消息字段不对齐吗?(尽管两者都使用了float-right,但似乎消息字段向右移动了几个像素)非常感谢。 - Greg
@Greg 不要误解我的意思,但你的CSS混乱不堪,学习CSS定位,我在这里解释了[https://dev59.com/i3PYa4cB1Zd3GeqPn9v_],还有学习浮动是如何工作的,我在这里解释了[https://dev59.com/72Qn5IYBdhLWcg3wzZpU#16568504],这样你就可以得到干净的CSS,你的代码太脏了 :) - Mr. Alien
@Greg 抱歉,我提供了错误的定位链接,这是正确的链接 - https://dev59.com/G2Ij5IYBdhLWcg3wBA25#20718728 - Mr. Alien

8

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接