如何设置placeholder的样式

如何设置placeholder的样式,第1张

在input框中有时想将输入的字和placeholder设为不同的颜色或其它效果,这时就可以用以下代码来对placeholder进行样式设置了。

::-webkit-input-placeholder{}    /* 使用webkit内核的浏览器 */

:-moz-placeholder{}                  /* Firefox版本4-18 */

::-moz-placeholder{}                  /* Firefox版本19+ */

:-ms-input-placeholder{}           /* IE浏览器 */

注1:冒号前写对应的input或textarea元素等。

注2:placeholder属性是css3中新增加的属性,IE9和Opera12以下版本的CSS选择器均不支持占位文本。

eg:

css代码

#input-test{

color: #FFC0CB

font-size: 1.2em

width: 180px

height: 36px

}

#input-test::-webkit-input-placeholder{

color: #ADD8E6

}

#input-text::-moz-placeholder{  //不知道为何火狐的placeholder的颜色是粉红色,怎么改都不行,希望有大牛路过帮忙指点

color: #ADD8E6

}

#input-text:-ms-input-placeholder{  //由于我的IE刚好是IE9,支持不了placeholder,所以也测试不了(⊙﹏⊙),有IE10以上的娃可以帮我试试

color: #ADD8E6

}

html代码

<div id="container">

  <input id="input-test" type="text" placeholder="修改placeholder样式" />

</div>

效果如下图所示:

PS:除此之外,还能修改placeholder的font-weight等样式。

eg:

我加了句 "font-weight: bold",效果如下图所示:

问题一:ppt里如何设置占位符 你说的那个应该叫项目符号。

问题二:ppt占位符怎么设置 你说的那个应该叫项目符号。

问题三:ppt标题占位符设置的快速样式在哪里 ppt设置标题占位符快速样式的步骤:

1、点视图菜单――幻灯片母版;

2、选择标题占位符,鼠标右键选择设置形状格式,里面可以设置标题填充色、标题边框颜色等;

3、设置完成后,点关闭母版视图,母版中设置的标题样式就应用在了所有的幻灯片上。

问题四:html中怎么设定input的占位符字体颜色 placeholder是HTML5的新属性,并不是CSS3,,,CSS3和CSS2都是一样的,是在里,或者CSS文件里,或者style=这里面的。

一,使用伪类:

:-moz-placeholder { /* Mozilla Firefox 4 to 18 */

color: #f00

}

::-moz-placeholder { /* Mozilla Firefox 19+ */

color: #f00

}

input:-ms-input-placeholder,

textarea:-ms-input-placeholder {

color: #f00

}

input::-webkit-input-placeholder,

textarea::-webkit-input-placeholder {

color: #f00

}

二是使用JS来替换掉占位符:

$('[placeholder]').focus(function() {

var input = $(this)

if (input.val() == input.attr('placeholder')) {

input.val('')

input.removeClass('placeholder')

}

}).blur(function() {

var input = $(this)

if (input.val() == '' || input.val() == input.attr('placeholder')) {

input.addClass('placeholder')

input.val(input.attr('placeholder'))

}

}).blur()

$('[placeholder]').parents('form').submit(function() {

$(this).find('[placeholder]').each(function() {

var input = $(this)

if (input.val() == input.attr('placeholder')) {

input.val('')

}

})

})

CSS:

form .placeholder {

color: #222

>

问题五:什么叫占位符? 主要用于网页排版,当你决定要在版面的一个地方放一张图片或其他东西的时候并且你有多种选择一时决定不了,你就可以先放一个图像占位符设置好宽高,待你以后决定好了再来放入需要的图片。

另外占位符也常用于网页中调节版面中各部分位置,比如你可以将占位符的高设为1个象素,长度根据需要设置就可以空出你需要的距离,而且在页面上还看不到你的占位符。同样你也可以设置宽为1个象素和你需要的高度来空出你需要的部分与部分之间的垂直距离。

偷来的,不知道这样能不能够满足你。。。

简单地说就是先用来占地方的东东。。。

呵呵

问题六:Word中能如何插入占位符? word里没有占位符。这是PowerPoint的专用术语

问题七:ios中uitextview怎么设置占位符 在UITextField中自带placeholder属性,可以用于提示输入框信息。但是UITextView并不具备此功能

介绍两种方法来实现:

第一种:

初始化UITextView

首先定义UITextView

UITextView *textView = [[UITextView alloc] init]

textView.font = [UIFont systemFontOfSize:14]

textView.frame =CGRectMake(10, 0, cell.contentView.bounds.size.width-20, side)

textView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth

textView.backgroundColor = [UIColor whiteColor]

[cell.contentView addSubview:textView]

textView.hidden = NO

textView.delegate = self

其次在UITextView上面覆盖个UILable,UILable设置为全局变量。

uilabel.frame =CGRectMake(17, 8, cell.contentView.bounds.size.width - side+10, 20)

uilabel.text = @请填写审批意见...

uilabel.enabled = NOlable必须设置为不可用

uilabel.backgroundColor = [UIColor clearColor]

[cell.contentView addSubview:uilabel]

实现UITextView的代理

-(void)textViewDidChange:(UITextView *)textView

{

self.examineText = textView.text

if (textView.text.length == 0) {

uilabel.text = @请填写审批意见...

}else{

uilabel.text = @

}

}

第二种:

UITextView 实现 placeholder 及隐藏键盘

#import

@interface UIPlaceHolderTextView : UITextView {

NSString *placeholder

UIColor *placeholderColor

@private

UILabel *placeHolderLabel

}

@property(nonatomic, retain) UILabel *placeHolderLabel

@property(nonatomic, retain) NSString *placeholder

@property(nonatomic, retain) UIColor *placeholderColor

-(void)textChanged:(NSNotificatio......>>

问题八:ppt2010对标题占位符设置“细微效果-蓝色,强调颜色1”详细 *** 作怎么弄,还有把文字设置为深蓝但 10分 这是利用幻灯片母板制作的步骤吧,强调颜色在文字颜色里,选第一个就行。文字设置颜色可以自定义为深蓝色。

问题九:revit怎么生成占位符如何设置? 很简单,风管和管道占位符是项目初期用来代替风管和管道的,提高软件运行速度。可以相互转换。你再问的具体点,是问怎么画呢,还是问怎么转换。

问题十:ppt 占位符 怎么删除 选中,删除。

首先我们先简单写个html页面,里面放一个input和一个textarea,简单设置一下基本样式,注意写上

placeholder

然后在浏览器中预览一下效果,会看到默认的placeholder颜色是灰色的。

再然后就是设置placeholder的字体颜色了,因为不同浏览器存在...


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/7711936.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-08
下一篇 2023-04-08

发表评论

登录后才能评论

评论列表(0条)

保存