2016-10-26 5 views
0

필자는 입력란을 내 레이블 (담당자 세트 및 무게) 옆에 넣으려고하지만 다음 줄로 계속 밀어 넣습니다. 어떻게하면 같은 줄에 강제로 넣을 수 있습니까? 필자는 입력 된 CSS 형식으로 인라인 블록을 사용하고 인라인 블록을 내 레이블 CSS에 넣으려고했지만 다음 줄에도 그대로 머물러 있습니다. 이 문제를 어떻게 해결할 수 있습니까?입력 상자가 다른 줄에 강제로 나타나는 이유는 무엇입니까?

Website so far

* { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; -ms-box-sizing:border-box; -o-box-sizing:border-box; box-sizing:border-box; } 

html { width: 100%; height:100%; overflow:scroll; 
    background: url("gym.jpg") no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

body { 
    width: 100%; 
    height:100%; 
    font-family: 'Open Sans', sans-serif; 
} 

.login { 
    position: absolute; 
    top: 43%; /* Form is 45% from top */ 
    left: 50%; /* Form is 50% across screen*/ 
    margin: -150px 0 0 -150px; /* Position of form on screen */ 
    width:300px; /* width of form */ 
    height:300px; /* height of form */ 
    border: 5px; 
} 

h1 { 
    color: #fff; 
    text-shadow: 2px 2px 4px #000000; 
    letter-spacing:1px; 
    text-align:center; 
    margin-bottom: 15px; /* Space below title */ 
    } 

h2 { 
    color: #fff; 
    text-shadow: 2px 2px 4px #000000; 
    letter-spacing:1px; 
    text-align:center; 
    margin-bottom: 15px; /* Space below title */ 
} 

h3 { 
    color: #fff; 
    text-shadow: 2px 2px 4px #000000; 
    letter-spacing:1px; 
    text-align:center; 
    margin-bottom: 15px; /* Space below title */ 
} 

h4 { 
    color: #fff; 
    text-shadow: 2px 2px 4px #000000; 
    letter-spacing:1px; 
    text-align:center; 
    margin-bottom: 15px; /* Space below title */ 
} 

label { 
    color: #fff; 
    text-shadow: 2px 2px 4px #000000; 
    letter-spacing:2px; 
    text-align:center; 
    margin-bottom: 15px; /* Space below title */ 
} 

.login input { 
    width: 100%; /* 100% of form */ 
    margin-bottom: 10px; /* gap in between each element */ 
    background-color: rgba(0,0,0,0.5); /* background color (opacity 3) of all INPUT elements in login class*/ 
    border: none; /* Border of input elements in login class */ 
    outline: none; 
    padding: 10px; /* height of each input element in login class*/ 
    font-size: 13px; /* font size */ 
    color: #fff; /* font color */ 
    border: 1px solid rgba(0,0,0,0.2); /* 1 pixel black border of opacity 2 for each input element in login*/ 
    border-radius: 4px; /* can curve the login details elements */ 
} 

.slide input { 
    width: 10%; 
} 

.exdisplay input { 
    width: 75%; 
    text-align: center; 
} 

.statdisplay input { 
    width: 30px; 
    height: 10px; 
    text-align: center; 
} 

.displayExerManual h3 { 
    display: inline-block; 
    margin-top: 5px; 
} 

.displayExerManual input { 
    width: 10%; 
} 

/* hiding input box */ 

#reps{ 
    display: none; 
} 
#exercheckbox:checked ~ #reps{ 
    display: block; 
} 

#sets{ 
    display: none; 
} 
#exercheckbox:checked ~ #sets{ 
    display: block; 
} 

#weight{ 
    display: none; 
} 
#exercheckbox:checked ~ #weight{ 
    display: block; 
} 

HTML :

<body> 
    <div class="login"> 

    <h1>Gym Planner</h1> 
    <form method="post" action="storeexercisesauto.php"> 
     <div class="displayExerManual"> 
      <input type="hidden" name="exercheckbox" value=0> 
      <h3><?php echo $name; ?></h3><input type="checkbox" name="exercheckbox" id="exercheckbox" value="1"> 

      <input type="hidden" name="reps<?php echo $x ?>" value = "0" autocomplete="off" required /> 
      <input type="hidden" name="sets<?php echo $x ?>" value = "0" autocomplete="off" required /> 
      <input type="hidden" name="weight<?php echo $x ?>" value = "0" autocomplete="off" required /> 
      <label id="reps">Reps: </label><input type="text" name="reps<?php echo $x ?>" id="reps"> 
      <h4 id="sets">Sets: </h4><input type="text" name="sets<?php echo $x ?>" id="sets"> 
      <h4 id="weight">Weight: </h4><input type="text" name="weight<?php echo $x ?>" id="weight"> 
     </div> 
    </form> 

    </div> 
    </body> 
+0

입니다 : 블록,'대신'디스플레이 : 인라인 블록;'? – Justinas

답변

0

난 당신이 로그인 패널의 폭과 텍스트 상자의 폭을 늘리려면이 CSS를 변경해야 할 것 같아요. 레이블로 인라인하려면 텍스트 상자를 양식의 100 %로 사용할 수 없습니다. 당신이 100 %를 넣어 경우 <h4></h4> 태그 대신 <label></label> 태그를 사용했기 때문에 그것은 입력 상자가 다음 줄로 강제되고 부모

.login { 
    position: absolute; 
    top: 43%; /* Form is 45% from top */ 
    left: 50%; /* Form is 50% across screen*/ 
    margin: -150px 0 0 -150px; /* Position of form on screen */ 
    width:500px; /* width of form */ 
    height:300px; /* height of form */ 
    border: 5px; 
} 

.login input { 
    width: 250px; 
    margin-bottom: 10px; /* gap in between each element */ 
    background-color: rgba(0,0,0,0.5); /* background color (opacity 3) of all INPUT elements in login class*/ 
    border: none; /* Border of input elements in login class */ 
    outline: none; 
    padding: 10px; /* height of each input element in login class*/ 
    font-size: 13px; /* font size */ 
    color: #fff; /* font color */ 
    border: 1px solid rgba(0,0,0,0.2); /* 1 pixel black border of opacity 2 for each input element in login*/ 
    border-radius: 4px; /* can curve the login details elements */ 
} 
0

의 전체 폭을.

업데이트 된 HTML 코드는 아마 당신의`label`가`표시입니다

<body> 
    <div class="login"> 

    <h1>Gym Planner</h1> 
    <form method="post" action="storeexercisesauto.php"> 
     <div class="displayExerManual"> 
      <input type="hidden" name="exercheckbox" value=0> 
      <h3><?php echo $name; ?></h3><input type="checkbox" name="exercheckbox" id="exercheckbox" value="1"> 

      <input type="hidden" name="reps<?php echo $x ?>" value = "0" autocomplete="off" required /> 
      <input type="hidden" name="sets<?php echo $x ?>" value = "0" autocomplete="off" required /> 
      <input type="hidden" name="weight<?php echo $x ?>" value = "0" autocomplete="off" required /> 
      <label id="reps">Reps: </label><input type="text" name="reps<?php echo $x ?>" id="reps"> 
      <label id="sets">Sets: </label><input type="text" name="sets<?php echo $x ?>" id="sets"> 
      <label id="weight">Weight: </label><input type="text" name="weight<?php echo $x ?>" id="weight"> 
     </div> 
    </form> 

    </div> 
    </body> 
관련 문제