2017-06-17 101 views
0

我有一个表单,其中有两个输入字段和一个按钮。第一个输入字段正常工作,但第二个输入字段和按钮都不可点击。引导表单输入字段和按钮不可点击

注意:遵循堆栈溢出规定,所有codepen链接后面都有代码。所以这篇文章可能看起来不太长。

这是页面的Codepen。见下面的代码。

HTML`

<body> 
    <div class="container-fluid"> 

     <div class="row" id="row-masthead"> 
      <div class="col-md-12 col-sm-12 col-xs-12"> 

       <div id="logo-enclosure"> 
        <img src="justlogo.png" alt="" id="logo"> 
       </div> 

       <div id="masthead-welcome-note"> 
        <h1>Wow Your Customers</h1> 
       </div> 

       <div id="masthead-welcome-note-small">with exceptional customer service. Try Hiver!</div> 

       <div id="form-enclosure"> 
        <form> 
         <div class="form-group"> 
          <label for="input-email">Enter email</label> 
          <input type="email" class="form-control" id="input-email"> 
         </div> 
         <div class="form-group"> 
          <label for="input-phone">Enter phone</label> 
          <input type="email" class="form-control" id="input-phone"> 
         </div> 
         <button type="submit" class="btn btn-default">GET STARTED FOR FREE</button> 
        </form> 
       </div> 


      </div> 
     </div> 

     <div class="row" id="row-reviews"> 
      <div class="col-md-12 col-sm-12 col-xs-12"> <!-- column 12--> 

       <div id="image-quote-container"> 
        <i class="fa fa-quote-left" aria-hidden="true"></i> 
        <div id="circular-image-container"> 
         <img src="bean.png" id="circular-image"> 
        </div> 
        <div id="quote"> 
         Hiver is hands down the best way for us to collaborate on Gmail. Managing our scheduling has never been easier. 

         <footer><strong>Christian Leybold - (General Partner, eVentures.vc)</strong></footer> 
        </div> 
       </div> 

       <div id="close-quote-container"> 
        <i class="fa fa-quote-right" aria-hidden="true"></i> 
       </div> 

      </div> 
     </div> 

     <div class="row"> 

     </div> 

     <div class="row"> 

     </div> 

    </div> 
</body> 

CSS

body{ 
    overflow-x: hidden; 
    height: 100vh; 
} 

.container-fluid{ 
    padding: 0; 
} 

#row-masthead{ 
    background-color: #069A78; 
    height: 27vh; 
} 

#logo-enclosure{ 
    background-color: ; 
    margin-top: 1%; 
    margin-left: 4%; 
} 

#logo{ 
    width: 120px; 
    height: 48px; 
} 

#masthead-welcome-note h1{ 
    font-family: 'Ubuntu', sans-serif; 
    color: white; 
    margin-left: 4%; 
    margin-top: 1%; 
    font-size: 42px; 
    background-color: ; 
} 
#masthead-welcome-note-small{ 
    font-family: 'Open Sans', sans-serif; 
    margin-top: -0.5%; 
    margin-left: 4%; 
    font-size: 18px; 
    color: white; 
    background-color: ; 
} 

#form-enclosure{ 
    background-color: white; 
    border-radius: 2%; 
    padding-top: 15px; 
    padding-left: 20px; 
    padding-right: 20px; 
    padding-bottom: 15px; 
    width: 25%; 
    position: absolute; 
    right: 6%; 
    top: 48%; 
    border-bottom: 1.5px solid #D1D1D1; 
    border-right: 1px solid #D3D3D3; 
} 

#form-enclosure > form > div > label{ 
    color: #B0A9A9; 
    font-weight: normal; 
    font-size: 13px; 
} 

#form-enclosure > form > div > input{ 
    background-color: #F3F3F3; 
    border-color: #ECECEC; 
} 

#form-enclosure > form > button{ 
    width: 100%; 
    height: 2.8em; 
    color: white; 
    background-color: #E87A06; 
    border: none; 
    font-weight: bold; 
    font-size: 12px; 
} 

#row-reviews{ 
    height: 30vh; 
    background-color: #F6F6F6; 

    /*border: 1px solid lightgrey;*/ 
} 

#row-reviews > div{ /* this is the column inside the row */ 
    height: 100%;  /* the column should take full height of the row ie 30vh */ 
    background-color: ; 
    display: flex; 
    justify-content: left; 
    align-items: center; 
} 

#image-quote-container{ 
    margin-left: 4%; 
    width: 52%; 
    height: 90%; 
    position: relative; /*relative parent*/ 

    /*border: 1px solid lightgrey;*/ 
} 

i.fa-quote-left{ 
    font-size: 30px; 
    color: lightgrey; 
    margin-top: 4%; 
    float: left; 
    width: 3%; /* to prevent jumping effect*/ 

    /*background-color: plum; 
    border: 1px solid black;*/ 
} 

#circular-image-container{ 
    margin-left: 3%; /* moving bean image right from open quote*/ 
    margin-top: 6%;  /* moving bean image bottom from its reference point ie parent div*/ 
    margin-right: 5%; /* maintain distance between image and texts on the right*/ 
    float: left; 
} 

#circular-image{ 
    width: 100px; 
    height: 100px; 
    border-radius: 50%; 

    border: 1px solid #E4E4E4; 
} 

#quote{ 
    margin-top: 7%; 
    font-family: 'Open Sans', sans-serif; 
    font-style: italic; 
    font-size: 14px; 
    text-align: justify; 
    color: #7f8c8d; /* grey color for text */  

    /*border: 1px solid black;*/ 
} 

footer{ 
    font-style: normal; 
    font-size: 12px; 
    color: #2c3e50; 
    margin-top: 2%; 
} 

#close-quote-container{ 
    width: 3%; 
    height: 90%; 
    position: relative; /* relative parent for absolute close quote*/ 

    /*border: 1px solid lightgrey;*/ 
} 

i.fa-quote-right{ 
    font-size: 30px; 
    color: lightgrey; 
    position: absolute; 
    left: 0; 
    bottom: 0; 

    /*border: 1px solid black;*/ 
} 

`

然而,当我在=>Another pen link把形式单独它似乎很好地工作(即相同代码,但在这里输入字段和按钮是可点击的)。请参见下面的代码:

HTML

<body> 
    <div id="form-enclosure"> 
        <form> 
         <div class="form-group"> 
          <label for="input-email">Enter email</label> 
          <input type="email" class="form-control" id="input-email"> 
         </div> 
         <div class="form-group"> 
          <label for="input-phone">Enter phone</label> 
          <input type="email" class="form-control" id="input-phone"> 
         </div> 
         <button type="submit" class="btn btn-default">GET STARTED FOR FREE</button> 
        </form> 
       </div> 
</body> 

CSS

body{ 
    background-color: plum; 
} 

#form-enclosure{ 
    background-color: white; 
    border-radius: 2%; 
    padding-top: 15px; 
    padding-left: 20px; 
    padding-right: 20px; 
    padding-bottom: 15px; 
    width: 25%; 
    position: absolute; 
    right: 35%; 
    top: 30%; 
    border-bottom: 1.5px solid #D1D1D1; 
    border-right: 1px solid #D3D3D3; 
} 

#form-enclosure > form > div > label{ 
    color: #B0A9A9; 
    font-weight: normal; 
    font-size: 13px; 
} 

#form-enclosure > form > div > input{ 
    background-color: #F3F3F3; 
    border-color: #ECECEC; 
} 

#form-enclosure > form > button{ 
    width: 100%; 
    height: 2.8em; 
    color: white; 
    background-color: #E87A06; 
    border: none; 
    font-weight: bold; 
    font-size: 12px; 
} 

我无法理解这种行为。请帮我理解我做错了什么。

谢谢!

回答

1

减少大小col-md-6 col-sm-6 col-xs-12(这种测量是只是为了测试,您必须确定需要你测量)

元素的图像中所强调是越来越重叠在输入的文本元素,这让按钮既不可点击

enter image description here元素

更新答: 当您添加的位置是:绝对的,元素是从normalflow取出。 所以其他元素优先于具有绝对定位的元素。正常流量元素优于绝对元素。您也可以使用z-index来解决此问题。

add z-index:1;对于具有position:absolute的元素。这也可以解决你的问题。我认为这将是比我在第一

enter image description here

+0

提到谢谢你,工作的方式更容易。我不知道不适当的色料大小会产生这样的效果。请纠正一下我的理解。我觉得,由于包含表单的div具有'position:absolute'属性,它将会在DOM中失去它的空间并且首先浮动。我的问题是,为什么列大小会影响一个浮动的div,而不是DOM的一部分? –

+0

@SwagnikDutta请检查我更新的答案。如果它解决了你的问题,也接受答案。 – divine

+1

感谢您的更新。真的有用:) –

相关问题