在浏览器移动版

时间:2016-12-10 20:42:15

标签: html css

所以我试图让我的宽度在移动设备上获得100%的输入,现在它们看起来如下图所示。我将发布一个jsFiddle和一个片段,如果有人有任何想法,我将如何解决这个将是非常棒的。谢谢! Jsfiddle显示问题有点好,特别是因为它是移动我想要改变。

JSFIDDLE:https://jsfiddle.net/wpz221qk/

enter image description here

input{ 

	 border: none;
    border-bottom: 2px solid #959595;
	width:100%;
	margin:3px;
	color:#6C6A6A;
	padding-top:10px;
	padding-bottom: 10px;
	
	}
	
	.bottom{
		 border: none;
    
	
	margin:3px;
	
	color:#6C6A6A;
	padding-top:10px;
	padding-bottom: 10px;
	width:  300px;
	}
	.fa{
margin-right: 10px;



	}
	legend{
	color:white;
	}
	
.button {
  display: inline-block;
  padding: 15px 25px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  outline: none;
  color: #fff;
  background-color:#595959;
  border: none;
  border-radius: 15px;
  box-shadow: 0 9px #999;
  width: 150px;

}

.button:hover {background-color: #670809}

.button:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}



form.contact label{
display: block;
 
}

span{
display:block;
 border: none;
 color:white;
}

.clearfix:after {

  content:" ";

  display:block;

  clear:both;

}

section{
width: 95%;	

}
fieldset{
width: 45%;	
float:left;
border:none;

}

input.checks{
width: auto;	
}

.left{
width: 45%;
float:left;	
}
.right{
width:45%;
float: right;	
}
<div class="center clearfix" >
<h1 id="fourth">Contact</h1>

<form action="FormToEmail.php" method="POST" enctype="multipart/form-data" autocomplete="on" class="contact clearfix ">
<section class="clearfix">
<fieldset><legend>
<i class="fa fa-user" aria-hidden="true"></i>Personal Information
<hr class="style2">
</legend>
<label><span></span> <input name="first_name" type="text" value="" placeholder="First Name"  required/>
</label>
<label><span>
</span><input name="last_name" type="text" value="" placeholder="Last Name"  required/>
</label>
<label><span> </span><input name="date_of_birth" type="date" value="" placeholder="Date of Birth"  required/>
</label>

<label><span>
 </span><input type="number" name="quantity" min="1" max="6"  placeholder="number of years until next degree"></label>

<label ><span></span> <input name="level_of_education" type="hidden" value="" placeholder="level of education"  required/></label>
<select class="bottom" name="education_level">
<option value="High School">High School</option>
<option value="Undergraduate">Undergradute</option>
<option value="Graduate">Graduate</option>
</select>






</fieldset>




<fieldset><legend><i class="fa fa-envelope-o" aria-hidden="true"></i>
Contact Information  <hr class="style2"></legend>

<label><span>
</span><input class="ghost-input" name="email" value="" type="email" placeholder="youremail@email.com" autocomplete="off" /></label>

<label><span></span><input name="phonenumber" value="" type="tel" placeholder="763-858-9564" /></label>

<label><span></span><input name="website" value="" type="url" placeholder="https://yourwebsite.com"/></label>



</fieldset>




</section>




<section class="clearfix column"  >


<fieldset><legend><i class="fa fa-laptop" aria-hidden="true"></i>
What are your Interests <hr class="style2"></legend>


<section class="clearfix column left"  >
<label class="bottom span" ><span ><input name="webdesign" value="web_design" type="checkbox" class="checks"/>Web Design</span>
</label>

<label  class="bottom"><span><input name="webdevelopment" value="web_development" type="checkbox" class="checks" />Web Development</span>
</label>

<label  class="bottom"><span><input name="computerscience" value="computer_science" type="checkbox"class="checks" />Computer Science</span></label>

</section>
<section class="clearfix column left"  >

<label  class="bottom"><span><input name="graphicdesign" value="graphic_design" type="checkbox" class="checks"/>Graphic Design</span>
</label>

<label  class="bottom"><span><input name="userexperience" value="user_experience" type="checkbox" class="checks" />User Experience</span></label>

<label  class="bottom"><span><input  class="checks" name="appdevelopment" value="app_development" type="checkbox" />App Development</span>
</label>
</section>

</fieldset>



<fieldset><legend><i class="fa fa-volume-control-phone" aria-hidden="true">

</i>

Continuation <hr class="style2 toosmall"></legend>

<section class="clearfix column left"  >

<legend class="smaller">You can contact me by:</legend>
<br>

<div class="squish">
<label  class="bottom"><span><input class="checks" name="contact_me" type="radio" value="phone" checked/>Contact me by phone</span></label>





<label  class="bottom"><span><input class="checks" name="contact_me" type="radio" value="email" checked/>Contact me by email</span></label>

<label  class="bottom"><span><input class="checks"  name="contact_me" type="radio" value="text"/>Contact me by text</span></label>
<br>
</div>
</section>


<section class="clearfix column left"  >
<legend class="smaller" >I'm interested in:</legend>
<br>

<label  class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Undergraduate</span></label>
<label  class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Graduate</span></label>
<label  class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Online</span></label>
</section>


</fieldset>



</section>




<input class="button" name="submit_to_programmer" type="submit" value="Subm

2 个答案:

答案 0 :(得分:1)

fieldset宽度更改为100%。

这是DEMO

input {
  border: none;
  border-bottom: 2px solid #959595;
  width: 100%;
  margin: 3px;
  color: #6C6A6A;
  padding-top: 10px;
  padding-bottom: 10px;
}

.bottom {
  border: none;
  margin: 3px;
  color: #6C6A6A;
  padding-top: 10px;
  padding-bottom: 10px;
  width: 300px;
}

.fa {
  margin-right: 10px;
}

legend {
  width: 100%;
  color: white;
}

.button {
  display: inline-block;
  padding: 15px 25px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  outline: none;
  color: #fff;
  background-color: #595959;
  border: none;
  border-radius: 15px;
  box-shadow: 0 9px #999;
  width: 150px;
}

.button:hover {
  background-color: #670809
}

.button:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}

form.contact label {
  display: block;
}

span {
  display: block;
  border: none;
  color: white;
}

.clearfix:after {
  content: " ";
  display: block;
  clear: both;
}

section {
  width: 95%;
}

fieldset {
  width: 100%;
  float: left;
  border: none;
}

input.checks {
  width: auto;
}

.left {
  width: 45%;
  float: left;
}

.right {
  width: 45%;
  float: right;
}
<div class="center clearfix">
  <h1 id="fourth">Contact</h1>

  <form action="FormToEmail.php" method="POST" enctype="multipart/form-data" autocomplete="on" class="contact clearfix ">
    <section class="clearfix">
      <fieldset>
        <legend>
          <i class="fa fa-user" aria-hidden="true"></i>Personal Information
          <hr class="style2">
        </legend>
        <label><span></span>
          <input name="first_name" type="text" value="" placeholder="First Name" required/>
        </label>
        <label><span>
</span>
          <input name="last_name" type="text" value="" placeholder="Last Name" required/>
        </label>
        <label><span> </span>
          <input name="date_of_birth" type="date" value="" placeholder="Date of Birth" required/>
        </label>

        <label><span>
 </span>
          <input type="number" name="quantity" min="1" max="6" placeholder="number of years until next degree">
        </label>

        <label><span></span>
          <input name="level_of_education" type="hidden" value="" placeholder="level of education" required/>
        </label>
        <select class="bottom" name="education_level">
          <option value="High School">High School</option>
          <option value="Undergraduate">Undergradute</option>
          <option value="Graduate">Graduate</option>
        </select>






      </fieldset>




      <fieldset>
        <legend><i class="fa fa-envelope-o" aria-hidden="true"></i> Contact Information
          <hr class="style2">
        </legend>

        <label><span>
</span>
          <input class="ghost-input" name="email" value="" type="email" placeholder="youremail@email.com" autocomplete="off" />
        </label>

        <label><span></span>
          <input name="phonenumber" value="" type="tel" placeholder="763-858-9564" />
        </label>

        <label><span></span>
          <input name="website" value="" type="url" placeholder="https://yourwebsite.com" />
        </label>



      </fieldset>




    </section>




    <section class="clearfix column">


      <fieldset>
        <legend><i class="fa fa-laptop" aria-hidden="true"></i> What are your Interests
          <hr class="style2">
        </legend>


        <section class="clearfix column left">
          <label class="bottom span"><span><input name="webdesign" value="web_design" type="checkbox" class="checks"/>Web Design</span>
          </label>

          <label class="bottom"><span><input name="webdevelopment" value="web_development" type="checkbox" class="checks" />Web Development</span>
          </label>

          <label class="bottom"><span><input name="computerscience" value="computer_science" type="checkbox"class="checks" />Computer Science</span></label>

        </section>
        <section class="clearfix column left">

          <label class="bottom"><span><input name="graphicdesign" value="graphic_design" type="checkbox" class="checks"/>Graphic Design</span>
          </label>

          <label class="bottom"><span><input name="userexperience" value="user_experience" type="checkbox" class="checks" />User Experience</span></label>

          <label class="bottom"><span><input  class="checks" name="appdevelopment" value="app_development" type="checkbox" />App Development</span>
          </label>
        </section>

      </fieldset>



      <fieldset>
        <legend><i class="fa fa-volume-control-phone" aria-hidden="true">

</i> Continuation
          <hr class="style2 toosmall">
        </legend>

        <section class="clearfix column left">

          <legend class="smaller">You can contact me by:</legend>
          <br>

          <div class="squish">
            <label class="bottom"><span><input class="checks" name="contact_me" type="radio" value="phone" checked/>Contact me by phone</span></label>





            <label class="bottom"><span><input class="checks" name="contact_me" type="radio" value="email" checked/>Contact me by email</span></label>

            <label class="bottom"><span><input class="checks"  name="contact_me" type="radio" value="text"/>Contact me by text</span></label>
            <br>
          </div>
        </section>


        <section class="clearfix column left">
          <legend class="smaller">I'm interested in:</legend>
          <br>

          <label class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Undergraduate</span></label>
          <label class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Graduate</span></label>
          <label class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Online</span></label>
        </section>


      </fieldset>



    </section>




    <input class="button" name="submit_to_programmer" type="submit" value="Submit" />
    <input type="hidden" value="Message from Car Website" name="subject">
    <input name="redirect" type="hidden" value="thanks.html">
  </form>

答案 1 :(得分:0)

input{ 

	 border: none;
    border-bottom: 2px solid #959595;
	width:80vw; /* changed from 100% to 80 vh
	margin:3px;
	color:#6C6A6A;
	padding-top:10px;
	padding-bottom: 10px;
	
	}
	
	.bottom{
		 border: none;
    
	
	margin:3px;
	
	color:#6C6A6A;
	padding-top:10px;
	padding-bottom: 10px;
	width:  300px;
	}
	.fa{
margin-right: 10px;



	}
	legend{
	color:white;
	}
	
.button {
  display: inline-block;
  padding: 15px 25px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  outline: none;
  color: #fff;
  background-color:#595959;
  border: none;
  border-radius: 15px;
  box-shadow: 0 9px #999;
  width: 150px;

}

.button:hover {background-color: #670809}

.button:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}



form.contact label{
display: block;
 
}

span{
display:block;
 border: none;
 color:white;
}

.clearfix:after {

  content:" ";

  display:block;

  clear:both;

}

section{
width: 95%;	

}
fieldset{
width: 45%;	
float:left;
border:none;

}

input.checks{
width: auto;	
}

.left{
width: 45%;
float:left;	
}
.right{
width:45%;
float: right;	
}
<div class="center clearfix" >
<h1 id="fourth">Contact</h1>

<form action="FormToEmail.php" method="POST" enctype="multipart/form-data" autocomplete="on" class="contact clearfix ">
<section class="clearfix">
<fieldset><legend>
<i class="fa fa-user" aria-hidden="true"></i>Personal Information
<hr class="style2">
</legend>
<label><span></span> <input name="first_name" type="text" value="" placeholder="First Name"  required/>
</label>
<label><span>
</span><input name="last_name" type="text" value="" placeholder="Last Name"  required/>
</label>
<label><span> </span><input name="date_of_birth" type="date" value="" placeholder="Date of Birth"  required/>
</label>

<label><span>
 </span><input type="number" name="quantity" min="1" max="6"  placeholder="number of years until next degree"></label>

<label ><span></span> <input name="level_of_education" type="hidden" value="" placeholder="level of education"  required/></label>
<select class="bottom" name="education_level">
<option value="High School">High School</option>
<option value="Undergraduate">Undergradute</option>
<option value="Graduate">Graduate</option>
</select>






</fieldset>




<fieldset><legend><i class="fa fa-envelope-o" aria-hidden="true"></i>
Contact Information  <hr class="style2"></legend>

<label><span>
</span><input class="ghost-input" name="email" value="" type="email" placeholder="youremail@email.com" autocomplete="off" /></label>

<label><span></span><input name="phonenumber" value="" type="tel" placeholder="763-858-9564" /></label>

<label><span></span><input name="website" value="" type="url" placeholder="https://yourwebsite.com"/></label>



</fieldset>




</section>




<section class="clearfix column"  >


<fieldset><legend><i class="fa fa-laptop" aria-hidden="true"></i>
What are your Interests <hr class="style2"></legend>


<section class="clearfix column left"  >
<label class="bottom span" ><span ><input name="webdesign" value="web_design" type="checkbox" class="checks"/>Web Design</span>
</label>

<label  class="bottom"><span><input name="webdevelopment" value="web_development" type="checkbox" class="checks" />Web Development</span>
</label>

<label  class="bottom"><span><input name="computerscience" value="computer_science" type="checkbox"class="checks" />Computer Science</span></label>

</section>
<section class="clearfix column left"  >

<label  class="bottom"><span><input name="graphicdesign" value="graphic_design" type="checkbox" class="checks"/>Graphic Design</span>
</label>

<label  class="bottom"><span><input name="userexperience" value="user_experience" type="checkbox" class="checks" />User Experience</span></label>

<label  class="bottom"><span><input  class="checks" name="appdevelopment" value="app_development" type="checkbox" />App Development</span>
</label>
</section>

</fieldset>



<fieldset><legend><i class="fa fa-volume-control-phone" aria-hidden="true">

</i>

Continuation <hr class="style2 toosmall"></legend>

<section class="clearfix column left"  >

<legend class="smaller">You can contact me by:</legend>
<br>

<div class="squish">
<label  class="bottom"><span><input class="checks" name="contact_me" type="radio" value="phone" checked/>Contact me by phone</span></label>





<label  class="bottom"><span><input class="checks" name="contact_me" type="radio" value="email" checked/>Contact me by email</span></label>

<label  class="bottom"><span><input class="checks"  name="contact_me" type="radio" value="text"/>Contact me by text</span></label>
<br>
</div>
</section>


<section class="clearfix column left"  >
<legend class="smaller" >I'm interested in:</legend>
<br>

<label  class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Undergraduate</span></label>
<label  class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Graduate</span></label>
<label  class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Online</span></label>
</section>


</fieldset>



</section>




<input class="button" name="submit_to_programmer" type="submit" value="Subm