Jump to content
  • 0

form - label - input. Заступает текст


ZoomAll
 Share

Question

Приветствую всех.

Проблема в следующем:

h_1328621631_2988293_ab4cd4e7fa.png

игры с параметрами padding и margin для form, label, input

не дало результата - текст все-равно заступает за чекбокс.....

вот код:

<html>
<head>
<title>test</title>
<style type="text/css">
form {padding: 0 0 0 5; margin: 0 0 0 5;}
</style>
</head>
<body>

<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
</body>
</html>

Edited by ZoomAll
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Можно задать марджин для лейбла, освободив место справа, и вынести туда чекбокс абсолютом, отрицательным марджином или хоть текст-индентом.

А можно с помощью дополнительного элемента, но, пожалуй, даже незачем в вашем случае так делать.

Link to comment
Share on other sites

  • 0

Можно задать марджин для лейбла, освободив место справа, и вынести туда чекбокс абсолютом, отрицательным марджином ...

Посмотрите, слепляется все:

h_1328622161_6879876_3af6ec4074.png

код:

<html>
<head>
<title>test</title>
<style type="text/css">
label {margin: 0 0 0 5;}
input {position: absolute; margin: 0 0 0 -5;}
</style>
</head>
<body>

<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
</body>
</html>

отрицательный text-indent тоже к сожалению не дал результата - строки слепились

подскажите, что я не так делаю

Link to comment
Share on other sites

  • 0

<style>
label{position:relative;display:block;padding-left:20px;background:#bbb;}
input{position:absolute;left:3px;top:3px;}
</style>

<form>
<label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label>
<label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label>
</form>

Edited by Switch74
Link to comment
Share on other sites

  • 0

А в вашем неработающем примере начните с того, что укажите единицы измерения для полей :)

вы имеете ввиду указать "em" или "px"? если я вас правильно понял, то указав для margin поочередно каждое из них получил точно такой же некорректный "слипшийся" результат

Link to comment
Share on other sites

  • 0

А в вашем неработающем примере начните с того, что укажите единицы измерения для полей :)

вы имеете ввиду указать "em" или "px"? если я вас правильно понял, то указав для margin поочередно каждое из них получил точно такой же некорректный "слипшийся" результат

Ну да, и блочности не хватило лейблам )

<!DOCTYPE html>
<html>
<head>
<title>test</title>
<style type="text/css">
label {margin: 0 0 0 15px; display: block;}
input {position: absolute; margin: 0 0 0 -15px;}
</style>
</head>
<body>

<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
</body>
</html>

Link to comment
Share on other sites

  • 0

rash, спасибо за потраченное время, все работает

тока немного чекбоксы вверх уехали, вот поправил

<html>
<head>
<title>test</title>
<style type="text/css">
label {margin: 4px 0 0 15px; display: block;}
input {position: absolute; margin: 4px 0 0 -15px;}
</style>
</head>
<body>

<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
<form><label><input type="checkbox">So I've been experimenting with different margins and paddings on lists, and so far I can't seem to figure it out. The object I'm after seems simple enough; I want less of an "indent" (is that padding or margin?) on the left edge. In other words, I want the little dots to be right at the edge of the containing box.</label><br/>
</body>
</html>

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