2016-11-23 131 views
-1

我創建了此註冊表單,但是我無法將兩個div標籤放在一行中,只有在最小化窗口時纔會發生。有什麼建議麼?編號喜歡將Facebook和G +下的文本放置在文本旁邊以及兩個文本字段。將兩個標籤並排放置

<div class="col-md-offset-2 col-md-8 text-center"> 
     <div class="container-fluid"> 
      <div id="logo-signup"> 
       <img class="img-responsive" src="uv.png"> 
      </div> <!-- logo --> 

      <div class="signup-header"> 
       <label class="uv-header">United Volunteers</label> 
       <label class="sm-title">Register Using Your Social Media Account</label> 

       <button type="submit" class="btn-facebook-signup">Register With Facebook</button> 
       <button type="submit" class="btn-gmail-signup">Register With Google+</button> 
      </div> <!-- login-form -->  
     </div> <!-- container-fluid --> 
    </div> <!-- col --> 

    <div class="col-md-offset-2 col-md-8 "> 
     <div class="container-fluid"> 
       <div class="signup-form2"> 
        <label class="signup-title"><span>Personal Information</span></label> 

        <div class="signup-labels"> 
         <input type="text" class="form-input" placeholder="First Name" style="margin-right:10px"> 
         <input type="text" class="form-input" placeholder="Last Name"> 
        </div> 

        <label class="signup-title"><span>Address Information</span></label> 
        <label class="signup-title"><span>Skills</span></label> 
        <label class="signup-title"><span>Volunteering Area</span></label> 
        <label class="signup-title"><span>Account Information</span></label> 
       </div> 
     </div> 
    </div> 

.signup-header { 
    top:90px; 
    position:relative; 
    box-sizing: border-box; 
    margin: 25px auto; 
    margin-bottom:0px; 
    width: 100%; 
    max-width:1000px; 
    overflow: hidden; 
    background-color: white; 
    padding: 25px 50px 50px 50px; 
    box-shadow: 1px 5px 2px #330000; 
} 

.signup-form2 { 
    top:90px; 
    position:relative; 
    box-sizing: border-box; 
    margin: 25px auto; 
    margin-bottom:0px; 
    width: 100%; 
    max-width:1000px; 
    background-color: white; 
    padding: 10px 50px 50px 50px; 
    box-shadow: 1px 5px 2px #330000; 
    z-index: 1; 
} 

.uv-header{ 
    font-weight:bold; 
    font-size:35px; 
    font-family:Candara; 
    float:left; 
    padding-left:225px; 
} 

.sm-title { 
    float:left; 
    padding-left:225px; 
    margin-bottom: 5px; 
    font-weight: bold; 
    font-family:Candara; 
    font-size: 20px; 
} 

.sm-signup{ 
    font-size:35px; 
    font-family:Candara; 
    float:left; 
    padding-left:225px; 
} 

#logo-signup { 
    top:70px; 
    left: 17%; 
    transform: translateX(-50%); 
    position:absolute; 
    background-color: white; 
    background-size: 170px auto; 
    background-repeat: no-repeat; 
    height: 170px; 
    width: 170px; 
    padding: 0px; 
    border: 5px solid white; 
    box-shadow: 1px 3px 2px grey; 
    z-index: 1; 
} 

h1 { 
    font-weight:bold; 
    font-size:35px; 
    font-family:Candara; 
    text-align: center; 
    margin: 100px auto 50px auto; 
} 

a { 
    text-decoration: none; 
} 

span{ 
    background:#fff; 
    padding:0 10px; 
} 

.signup-title{ 
    text-align:center; 
    margin-top:20px; 
    margin-bottom:20px; 
    width:100%; 
    border-bottom:1px solid #000; 
    line-height:0.1em; 
} 

.social_media { 
    text-align:center; 
    position:relative; 
    top:-75px; 
} 

.label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
    font-family:Candara; 
    font-size: 20px; 
} 

.signup-labels{ 
    float:left; 
} 

.btn-signup { 
    background-color: firebrick; 
    font-family:Candara; 
    font-size: 20px; 
    color: white; 
    padding: 10px; 
    border: 1px solid firebrick; 
    border-radius: 5px; 
    box-shadow: 2px 4px 4px #330000; 
    width: 200px; 
    margin:auto; 
    margin-top:200px; 
    display:block; 
} 

.btn-facebook-signup { 
    background-image: url(fb.gif); 
    background-color: #3b5998; 
    padding: 0px; 
    border: 3px solid white; 
    border-radius: 5px; 
    box-shadow: 1px 2px 2px grey; 
    margin: auto; 
    background-size: contain; 
    background-repeat: no-repeat; 
    height: 50px; 
    width: 250px; 
    padding-left:40px; 
    font-family: sans-serif; 
    font-size: 16px; 
    color: white; 
} 

.btn-gmail-signup { 
    background-image: url(g+.gif); 
    background-color: #dc4a38; 
    padding: 0px; 
    border: 3px solid white; 
    border-radius: 5px; 
    box-shadow: 1px 2px 2px grey; 
    margin: auto; 
    background-size: contain; 
    background-repeat: no-repeat; 
    height: 50px; 
    width: 250px; 
    padding-left:40px; 
    font-family: sans-serif; 
    font-size: 16px; 
    color: white; 
} 

.form-input { 
    width:80%; 
    height: 35px; 
    padding: 6px 12px; 
    font-size: 12px; 
    font-family: sans-serif; 
    vertical-align: middle; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    background-color: #f2f2f2; 
    line-height: 1.5; 
} 

.social_media-signup { 
    display:inline-block; 
} 
+0

您能否提供您的問題以及您希望看到結果的問題。同時我可以建議你可以嵌套'row'和'col - * - 6'標籤來創建內聯元素。 – haxxxton

回答

1

我建議你忘記float:left。這是一個古老的伎倆,嘗試新的與flex。

1st。使用一個包裹它們並在您的包裝中添加顯示器柔性,

2nd.then使用flex-direction:row。

u能找到有關彈性在這裏about flex

希望這將有助於ü得到一個線索,這是我的小提琴

.parent{ 
 
position:relative; 
 
display:flex; 
 
flex-direction:row; 
 
flex-wrap:wrap; 
 
align-items:center; 
 
justify-content:center; 
 
width:200px; 
 
height:200px; 
 
background:#ccc;} 
 

 
.child{ 
 
width:50px; 
 
height:50px; 
 
background:#000; 
 
margin:1px; 
 
}
<div class="parent"> 
 
    <div class="child"></div> 
 
    <div class="child"></div> 
 
</div>

0

ID喜歡放置在facebook和g +下注冊文字

在代碼中做了一些小修改,只需將兩個單獨的div添加到「United Volunteers」標籤,「註冊使用您的社交媒體帳戶」標籤和社交媒體按鈕上即可。

facebook和g +下的文字對面以及兩個文字 字段。

它是自動調整的。我對你的表單和CSS的一些小改動。 完整的演示請參閱完整頁面。

.signup-header { 
 
top:90px; 
 
position:relative; 
 
box-sizing: border-box; 
 
margin: 25px auto; 
 
margin-bottom:0px; 
 
width: 100%; 
 
max-width:1000px; 
 
overflow: hidden; 
 
background-color: white; 
 
padding: 25px 50px 50px 50px; 
 
box-shadow: 1px 5px 2px #330000; 
 
} 
 

 
.signup-form2 { 
 
top:90px; 
 
position:relative; 
 
box-sizing: border-box; 
 
margin: 25px auto; 
 
margin-bottom:0px; 
 
width: 100%; 
 
max-width:1000px; 
 
background-color: white; 
 
padding: 10px 50px 50px 50px; 
 
box-shadow: 1px 5px 2px #330000; 
 
z-index: 1; 
 
} 
 

 
.uv-header{ 
 
font-weight:bold; 
 
font-size:35px; 
 
font-family:Candara; 
 
float:left; 
 
padding-left:225px; 
 
} 
 

 
.sm-title { 
 
float:left; 
 
padding-left:225px; 
 
margin-bottom: 5px; 
 
font-weight: bold; 
 
font-family:Candara; 
 
font-size: 20px; 
 
} 
 

 
.sm-signup{ 
 
font-size:35px; 
 
font-family:Candara; 
 
float:left; 
 
padding-left:225px; 
 
} 
 

 
#logo-signup { 
 
top:70px; 
 
left: 17%; 
 
transform: translateX(-50%); 
 
position:absolute; 
 
background-color: white; 
 
background-size: 170px auto; 
 
background-repeat: no-repeat; 
 
height: 170px; 
 
width: 170px; 
 
padding: 0px; 
 
border: 5px solid white; 
 
box-shadow: 1px 3px 2px grey; 
 
z-index: 1; 
 
} 
 

 
h1 { 
 
font-weight:bold; 
 
font-size:35px; 
 
font-family:Candara; 
 
text-align: center; 
 
margin: 100px auto 50px auto; 
 
} 
 

 
a { 
 
text-decoration: none; 
 
} 
 

 
span{ 
 
background:#fff; 
 
padding:0 10px; 
 
} 
 

 
.signup-title{ 
 
text-align:center; 
 
margin-top:20px; 
 
margin-bottom:20px; 
 
width:100%; 
 
border-bottom:1px solid #000; 
 
line-height:0.1em; 
 
} 
 

 
.social_media { 
 
text-align:center; 
 
position:relative; 
 
top:-75px; 
 
} 
 

 
.label { 
 
display: block; 
 
margin-bottom: 5px; 
 
font-weight: bold; 
 
font-family:Candara; 
 
font-size: 20px; 
 
} 
 

 
.signup-labels{ 
 
float:left; 
 
} 
 

 
.btn-signup { 
 
background-color: firebrick; 
 
font-family:Candara; 
 
font-size: 20px; 
 
color: white; 
 
padding: 10px; 
 
border: 1px solid firebrick; 
 
border-radius: 5px; 
 
box-shadow: 2px 4px 4px #330000; 
 
width: 200px; 
 
margin:auto; 
 
margin-top:200px; 
 
display:block; 
 
} 
 

 
.btn-facebook-signup { 
 
background-image: url(fb.gif); 
 
background-color: #3b5998; 
 
padding: 0px; 
 
border: 3px solid white; 
 
border-radius: 5px; 
 
box-shadow: 1px 2px 2px grey; 
 
margin: auto; 
 
background-size: contain; 
 
background-repeat: no-repeat; 
 
height: 50px; 
 
width: 250px; 
 
padding-left:40px; 
 
font-family: sans-serif; 
 
font-size: 16px; 
 
color: white; 
 
} 
 

 
.btn-gmail-signup { 
 
background-image: url(g+.gif); 
 
background-color: #dc4a38; 
 
padding: 0px; 
 
border: 3px solid white; 
 
border-radius: 5px; 
 
box-shadow: 1px 2px 2px grey; 
 
margin: auto; 
 
background-size: contain; 
 
background-repeat: no-repeat; 
 
height: 50px; 
 
width: 250px; 
 
padding-left:40px; 
 
font-family: sans-serif; 
 
font-size: 16px; 
 
color: white; 
 
} 
 

 

 

 
.social_media-signup { 
 
display:inline-block; 
 
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 

 

 
<div class="col-md-offset-2 col-md-8 text-center"> 
 
    <div class="container-fluid"> 
 
     <div id="logo-signup"> 
 
      <img class="img-responsive" src="uv.png"> 
 
     </div> <!-- logo --> 
 

 
     <div class="signup-header"> 
 
      <div class="row"> <!--MODIFICATION--> 
 
      <label class="uv-header">United Volunteers</label> 
 
      <label class="sm-title">Register Using Your Social Media Account</label> 
 
      </div> <!--MODIFICATION--> 
 
<br> <!--MODIFICATION--> 
 
<div class="row"> <!--MODIFICATION--> 
 
      <button type="submit" class="btn-facebook-signup">Register With Facebook</button> 
 
      <button type="submit" class="btn-gmail-signup">Register With Google+</button> 
 
      </div> <!--MODIFICATION--> 
 
     </div> <!-- login-form --> 
 
     
 
     
 
     
 
     
 
    </div> <!-- container-fluid --> 
 
</div> <!-- col --> 
 

 
<div class="col-md-offset-2 col-md-8 "> 
 
    <div class="container-fluid"> 
 
      <div class="signup-form2"> 
 
       <label class="signup-title"><span>Personal Information</span></label> 
 

 
       <div class="signup-labels"> 
 

 
        <div class="col-md-6"> 
 
        <input type="text" class="form-control" placeholder="First Name" style="margin-right:10px"> 
 
        </div> 
 
<div class="col-md-6"> 
 
        <input type="text" class="form-control" placeholder="Last Name"> 
 
        </div> 
 
       </div> 
 

 
       <label class="signup-title"><span>Address Information</span></label> 
 
       <label class="signup-title"><span>Skills</span></label> 
 
       <label class="signup-title"><span>Volunteering Area</span></label> 
 
       <label class="signup-title"><span>Account Information</span></label> 
 
      </div> 
 
    </div> 
 
</div>

0

在AngularJS,這可以通過使用佈局= 「行」 來實現: -

<div style="cursor:pointer;" layout="row"> 
<div><i class="material-icons ">call</i></div> 
<div style="padding-top:4px">Personal Information</div> 
</div> 

PS:僅供參考,<i>標籤是包括在此圖標例如,所以通話會顯示一個通話圖標。它來自角度材料圖標包。您也可以使用任何其他標籤來替換它。