Jump to content
  • 0

позиционирование формы


Евгений_SB
 Share

Question

Ребят подскажите как отпозоционировать input и option что бы они были на одном уровне и одинакового размера,кучу видосов посмотрел на ютубе но там никто не объясняет толком как и почему

<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" href="style.css">
	</head>
	<body>
		<div class="container">
			<form action="#" method="post">
				<p><label for="name">Name: <input type="text"></label></p>
				<p><label for="passvord">Passvord: <input type="text"></label></p>
				<p><label for="forza">Forza:</label>
				<select name="nav" id="" size="1">
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
				</select></p>
				<p><label for="text" class="mes">message: <input type="text"></label></p>
				
			</form>

		</div>

	</body>
</html>
body {
	padding: 0;
	margin: 0;
}

.container {
	width: 300px;
	height: 450px;
	margin: 40px auto;
	background: #f3f1f3;

	border: 10px solid;
	border-radius: 30px;
	border-color: #848484;
}

.container p {
	display: block;
	position: relative;
	text-align: center;

	color: #000;
	text-transform: uppercase;
	font: 16px tahoma;
	top: 80px;
}
.container input, option {
	width: 160px;
	height: 40px;

	color: #848484;

}

 

2017-07-08_17-24-48.png

Edited by Евгений_SB
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1

в данном случае тот-же, но если у нас несколько select-ов на странице, то стиль будет применен ко всем, что не всегда может быть нужно, а так мы указываем на конкретный select

Link to comment
Share on other sites

  • 1

"Ребят подскажите как отпозоционировать input и option что бы они были на одном уровне"
Вы имели ввиду наверное, чтоб подписи и поля ввода были ровными, про уровень... 
Результат в скрине
 

<div class="container">
			<form action="#" method="post">
				<p><label for="name">Name: </label>
					<input type="text">
				</p>
				<p>
					<label for="passvord">Passvord: </label>
						<input type="text">
				</p>
				<p>
				<label for="forza">Forza:</label>
				<select name="nav" id="" size="1">
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
					<option value="forsa motors">forsa motors</option>
				</select></p>
				<p>
				<label for="text" class="mes">message: </label>
				<input type="text">
				</p>
				
			</form>

		</div>
.container input, .container select {
	width: 160px;
	height: 40px;

	color: #848484;

}

.container label {
	display: inline-block;
	width: 90px;
	text-align: right;
}

 

Безымянный6664.png

Link to comment
Share on other sites

  • 0
28 минут назад, AlexZaw сказал:

.container input, .container select {
	width: 160px;
	height: 40px;

	color: #848484;

}

 

Вопрос: а разве не тот же эффект будет, если написать так?:

.container input, select {
	width: 160px;
	height: 40px;

	color: #848484;

}

 

Link to comment
Share on other sites

  • 0

Ребят все сделал как вы написали, input с option выравнялись а label почему то улетели наверх хотя у вас на последнем скрине все ровно, ничего не пойму

14789508m.png

еще поменял значение в .container label ато не совсем ровно 90 было

14781316m.png

причем проверил в codepen там все работает как надо,что за

Edited by Евгений_SB
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy