Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.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
将HTML输入标记光标放在占位符文本的左侧_Html_Css - Fatal编程技术网

将HTML输入标记光标放在占位符文本的左侧

将HTML输入标记光标放在占位符文本的左侧,html,css,Html,Css,当我单击输入时,占位符文本将保持我希望它执行的操作,但当前显示的光标在文本顶部、中间右侧闪烁,我希望它直接在文本左侧闪烁。我想保持占位符文本居中。我该怎么做 这是我的领域: <input type="email" name="email" placeholder="enter your email..."> 可能发生的情况是文本对齐中心正在应用于输入。确保文本对齐设置为“左”,或完全不设置为“默认为左” 每个注释的更新代码: 我希望我的输入与代码段中的第一个输入相同, 唯一的区别是

当我单击输入时,占位符文本将保持我希望它执行的操作,但当前显示的光标在文本顶部、中间右侧闪烁,我希望它直接在文本左侧闪烁。我想保持占位符文本居中。我该怎么做

这是我的领域:

<input type="email" name="email" placeholder="enter your email...">

可能发生的情况是文本对齐中心正在应用于输入。确保文本对齐设置为“左”,或完全不设置为“默认为左”

每个注释的更新代码:


我希望我的输入与代码段中的第一个输入相同, 唯一的区别是光标在屏幕的左侧 居中文本

使用纯CSS实现这一点的唯一方法是使用另一个元素模拟占位符。这样做的副作用是在输入接收焦点时隐藏占位符

.家长{ 位置:相对位置; 最大宽度:200px; } 首次输入{ 文本对齐:左对齐; 位置:相对位置; z指数:1; 背景色:透明; 宽度:100%; } 第一个输入:焦点+.占位符{ 显示:无; } .占位符{ 位置:绝对位置; z指数:0; 排名:0; 左:0; 字体大小:13px; 宽度:100%; 身高:100%; 文本对齐:居中; } 键入某事。。
这正是Firefox和Chrome为我所做的。你到底在问什么?@JCollier你也在使用Firefox吗?你在输入字段上有css吗?@JCollier检查一下这个提琴是否需要javascript标记???@Pointy我想我问的很清楚。我希望光标位于文本的左侧,而不是中间。@Rachel_Gallen我正在使用Chrome。我希望我的输入与代码片段中的第一个相同,唯一的区别是光标位于居中文本的左侧。我不希望占位符文本也像第二个一样左对齐。
background-color:rgb(255, 255, 255);
border-bottom-color:rgb(255, 255, 255);
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
border-bottom-style:solid;
border-bottom-width:1px;
border-image-outset:0px;
border-image-repeat:stretch;
border-image-slice:100%;
border-image-source:none;
border-image-width:1;
border-left-color:rgb(255, 255, 255);
border-left-style:solid;
border-left-width:1px;
border-right-color:rgb(255, 255, 255);
border-right-style:solid;
border-right-width:1px;
border-top-color:rgb(255, 255, 255);
border-top-left-radius:0px;
border-top-right-radius:0px;
border-top-style:solid;
border-top-width:1px;
box-sizing:border-box;
color:rgb(0, 0, 0);
cursor:text;
display:inline-block;
font-family:azo-sans-web, sans-serif;
font-size:16px;
font-stretch:100%;
font-style:normal;
font-variant-caps:normal;
font-variant-east-asian:normal;
font-variant-ligatures:normal;
font-variant-numeric:normal;
font-weight:400;
height:72px;
letter-spacing:0.56px;
line-height:22.8571px;
margin-bottom:0px;
margin-left:0px;
margin-right:0px;
margin-top:0px;
outline-color:rgb(0, 0, 0);
outline-style:none;
outline-width:0px;
padding-bottom:24px;
padding-left:24px;
padding-right:24px;
padding-top:24px;
text-align:center;
text-indent:0px;
text-rendering:auto;
text-shadow:none;
text-transform:none;
width:702px;
word-spacing:0px;
writing-mode:horizontal-tb;
-webkit-appearance:none;
-webkit-box-direction:normal;
-webkit-rtl-ordering:logical;
-webkit-border-image:none;