Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 位置元素基于:内容之后_Jquery_Css - Fatal编程技术网

Jquery 位置元素基于:内容之后

Jquery 位置元素基于:内容之后,jquery,css,Jquery,Css,我正在使用:afterpsuedo元素的content参数来显示一组单选按钮的文本。然而,这导致了一切重叠 我想找到一种方法,在内容之后添加一些填充或使用:的边距,但不确定这是否可行 是否有一种方法可以根据前一个元素的psuedo元素之后的内容参数来定位某个内容 小提琴: HTML <form id="ValidateForm"> <label for="AgentId">Agent Id</label> <input id="AgentId" name

我正在使用
:after
psuedo元素的
content
参数来显示一组单选按钮的文本。然而,这导致了一切重叠

我想找到一种方法,在
内容之后添加一些填充或使用
:的边距,但不确定这是否可行

是否有一种方法可以根据前一个元素的
psuedo元素之后的
内容
参数来定位某个内容

小提琴:

HTML

<form id="ValidateForm">
<label for="AgentId">Agent Id</label>
<input id="AgentId" name="AgentId" type="text" >
<label for="LOB">LOB</label>
<input id="Retirement" name="LOB" type="radio" value="R"> 
<input id="Life" name="LOB" type="radio" value="L"> 
<input id="Business" name="LOB" type="radio" value="B">     
<label for="SignDate">Application Sign Date</label>
<input data-val="true" data-val-date="The field Application Sign Date must be a date." id="SignDate" name="SignDate" type="text" value="">
<input type="button" value="Go">
</form>

尝试设置元素的边距以创建足够的位置。。。我认为:在内容引用(计算相对于)元素而不是DOM之后,您需要在输入[type=radio]处设置宽度

#ValidateForm input[type=radio]{
    width: 80px !important;
}


我试着在你的小提琴示例中使用它,但我认为它不会起作用。我建议不要使用css内容,而只是使用Jquery的each函数迭代它们。例如:$('input[radio]').each(function(){$(this).after('Something');});这仍然只是根据单选按钮的框模型设置边距,而不是
中的内容:在
元素之后,它超出了CSS的能力,您需要使用javascript来帮助。
#ValidateForm input[type=radio]{
    width: 80px !important;
}
#ValidateForm input[type=radio]{
    margin-right: 80px !important;
}