Расстояние между входами в отзывчивой форме - PullRequest
0 голосов
/ 11 сентября 2018

Мне нужна идеальная форма пикселя. Могу ли я сделать?:
- расстояние между маленькими входами ровно 5px?
- сохраняйте расстояние слева и справа 0
- поддерживать расстояние выше 5px
- поддерживать форму отзывчивой

Как видно из примера, я не могу достичь первого условия.

form {
	position: relative;
	margin: 40px auto;
	text-align: center;
	width: 85%; max-width: 350px;
}	
input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 7px 15px; margin-bottom: 5px;
	border-radius:5px 5px 5px 5px;
	-moz-border-radius:5px 5px 5px 5px;
	-webkit-border-radius:5px 5px 5px 5px;
	font-size: 14px;
	outline: none;
	color: #bbb;
	border: 0;
	background-color: whiteSmoke;
}	
#mes-any {
	display: inline-block;
	width: 49%;
	float: left;
}
#cvc {
	display: inline-block;
	width: 49%;
	float: right;
}
<form action='externs/select-insert.php' method='post'>
	<input type='text' id='card' name='card' value=''>
	<input type='text' id='mes-any'name='mes-any' value=''>
	<input type='text' id='cvc'name= 'cvc' value=''>
</form>

Ответы [ 2 ]

0 голосов
/ 11 сентября 2018

Вы можете достичь этого используя css calc(50% - 2.5px)

form {
	position: relative;
	margin: 40px auto;
	text-align: center;
	width: 85%; max-width: 350px;
}	
input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 7px 15px; margin-bottom: 5px;
	border-radius:5px 5px 5px 5px;
	-moz-border-radius:5px 5px 5px 5px;
	-webkit-border-radius:5px 5px 5px 5px;
	font-size: 14px;
	outline: none;
	color: #bbb;
	border: 0;
	background-color: whiteSmoke;
}	
#mes-any {
	display: inline-block;
	width: calc(50% - 2.5px);
	float: left;
}
#cvc {
	display: inline-block;
	width: calc(50% - 2.5px);
	float: right;
}
<form action='externs/select-insert.php' method='post'>
	<input type='text' id='card' name='card' value=''>
	<input type='text' id='mes-any'name='mes-any' value=''>
	<input type='text' id='cvc'name= 'cvc' value=''>
</form>
0 голосов
/ 11 сентября 2018

Возможно, используя calc () , чтобы получить ширину:

form {
	position: relative;
	margin: 40px auto;
	text-align: center;
	width: 85%; max-width: 350px;
}	
input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 7px 15px; margin-bottom: 5px;
	border-radius:5px 5px 5px 5px;
	-moz-border-radius:5px 5px 5px 5px;
	-webkit-border-radius:5px 5px 5px 5px;
	font-size: 14px;
	outline: none;
	color: #bbb;
	border: 0;
	background-color: whiteSmoke;
}	
#mes-any {
	display: inline-block;
	width: calc(50% - 2.5px);
	float: left;
}
#cvc {
	display: inline-block;
	width: calc(50% - 2.5px);
	float: right;
}
<form action='externs/select-insert.php' method='post'>
	<input type='text' id='card' name='card' value=''>
	<input type='text' id='mes-any'name='mes-any' value=''>
	<input type='text' id='cvc'name= 'cvc' value=''>
</form>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...