让placeholder中的默认文字居中,或者缩进多少像素

摘要:
注释:InternetExplorer9以及更早的版本不支持placeholder属性。

直接给input或者textarea的样式加texta-align:center;

<input type="" name="" id="" value="" placeholder="信息" />

    ::-webkit-input-placeholder {
	color: #f00;
        text-align:center;
    }

让placeholder中的默认文字居中,或者缩进多少像素第1张

如果想要让提示文字距离边框有一定的距离,将text-align:center;去掉,加padding-left就可以

让placeholder中的默认文字居中,或者缩进多少像素第2张

下面是兼容性写法

 /* WebKit browsers */
			
::-webkit-input-placeholder {
	padding-left: 50px;
	color: #777;
}
/* Mozilla Firefox 4 to 18 */

:-moz-placeholder {
	color: #777;
	opacity: 1;
}
/* Mozilla Firefox 19+ */

::-moz-placeholder {
	color: #777;
	opacity: 1;
}
/* Internet Explorer 10+ */

:-ms-input-placeholder {
	color: #777;
}

Internet Explorer 10、Firefox、Opera、Chrome 以及 Safari 支持 placeholder 属性。
注释:Internet Explorer 9 以及更早的版本不支持 placeholder 属性。

免责声明:文章转载自《让placeholder中的默认文字居中,或者缩进多少像素》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇JAVA基础学习之路(六)数组与方法参数的传递(转载)Android Cursor之MergeCursor下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

opencv输出图片像素值

需求:在控制台输出灰度图像的像素值 代码: #include <stdio.h>#include <iostream>#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgpr...

Java——BufferedImage对象

BufferedImage对象中最重要的两个组件是Raster与ColorModel,分别用于存储图像的像素数据和颜色数据。 1、Raster对象的作用与像素存储 BufferedImage支持从Raster对象中获取任意位置(x,y)点的像素值p(x,y) image.getRaster().getDataElements(x,y,width,heigh...

iOS适配机型常用宏以及机型尺寸备注

关于物理和逻辑分辨率再整理一下,虽然并不关心太多的硬件原理,但是还是留个地方方便查阅吧。 1、代码 #pragma mark - 判断机型 /* 设备是否为iPhone4、iPhone4S (1)逻辑分辨率(point):320x480 (2)物理分辨率(pixel,像素):640x1136 (3)缩放因子 :@2x (4)PPI(像素密度):...

物理像素,ppi,逻辑分辨率和物理分辨率

1 明确几个概念:物理像素:屏幕物理像素屏幕像素密度ppi:pixels per inch,屏幕上每英寸可以显示的像素点的数量,即屏幕像素密度。顺便一提,ppi就是dpi,只不过有文章里说苹果喜欢用ppi,dpi安卓喜欢用,emmmm,所以还是用ppi吧。ppi的计算:屏幕对角线的屏幕物理像素密度除以屏幕尺寸。 以 iphone6 为例子,屏幕是 1334...

【前端开发】vue项目日程表12月平铺(日历)vue-material-year-calendar插件的使用教程

前言 项目中需要一个12个月平铺能按年份切换的日历功能,找了好多没找到好用的,最后找了个相似的改了下,效果如下  步骤 // 安装依赖 yarn add vue-material-year-calendary 源码 <template> <div class="weekdays-pages"> <div clas...

微信小程序实现动态设置placeholder提示文字

xml <input placeholder='{{phValue}}' type="text"  bindfocus='onFocus' bindblur='onBlur'/>   js Page({ // 页面的初始数据 data: { phValue:"请输入要录入的单词" }, onFocus: function (e) { this...