给select设置text-align:center在火狐浏览器下ok,但是在chrome浏览器无效,然后option在两个浏览器下设置text-align:center都是无效的,解决方法,设置样式如下 select:{

width: auto;
padding: 0 2%;
margin: 0;

}

option{

text-align:center;

}

1.必须设置select的padding,留意:padding: 0 2%; 前面的0表示上下,后面的值表示左右,这个值设置为1%都可以,但是不能是0,值越大,select就越长。

2.不要设置select的宽(width),auto就可以了。

设置select和option的文字居中的方法的更多相关文章

  1. 如何设置select和option的文字居中?

    今天在设置option文字居中时发现,给select设置text-align:center在火狐浏览器下ok,但是在chrome浏览器无效,然后option在两个浏览器下设置text-align:ce ...

  2. 设置select和option的文字居中

    select{ width: auto;      padding: 0 1%; //左右一定要设置      margin: 0; } option{ text-align:center; }

  3. 设置select,option文本居中

    设置select,option文本居中 可以通过 padding 属性设置内边距,使它看上去居中: select{ # 从左到右依次表示上内边距,右内边距,下内边距,左内边距: padding :0 ...

  4. php imagick 文字居中的方法

    php imagick 文字居中的方法<pre> public function getwenzinfo($nickName) { $nickNamelen = mb_strlen($ni ...

  5. android RadioButton文字居中的方法

    每个RadioButton的style原先是这样的: <style name="radiobutton_style" > <item name="and ...

  6. Android ToolBar标题文字居中的方法

    在项目的开发中,使用苹果手机的产品,出的界面效果图极有可能(我这里是一定)完全是按照苹果的界面风格来出的,例如界面顶部的title文字位置是水平居中 如图: 那么问题来了,当我们使用ToolBar控件 ...

  7. 关于css如何让图片文字居中的方法

    在将父级转换为单元格形式时,设置的相关属性  可以达到如下效果:

  8. 在IE8中使用padding设置select控件文字垂直居中

    在火狐.苹果.谷歌.欧鹏等主流浏览器中,select下拉表单的文字能够垂直居中,如图: 而在ie8中,select下拉表单的文字基本就是靠底部显示,如图: 那么,如何使得ie8下的select文字垂直 ...

  9. 设置TextView文字居中

    有2种方法可以设置TextView文字居中: 一:在xml文件设置:android:gravity="center" 二:在程序中设置:m_TxtTitle.setGravity( ...

随机推荐

  1. [异常笔记]required a bean of type 'org.quartz.JobExecutionContext' that could not be found

    *************************** APPLICATION FAILED TO START *************************** Description: Par ...

  2. 第一次使用Git上传本地项目到github

    看了好多帖子,终于在混乱中找到自己适合的方法......自我感觉这个比较简单. 先安装本地git,官方下载地址:http://git-scm.com/download/  根据你自己的系统 下载对应版 ...

  3. redis之哨兵(Sentinel)

    Redis-Sentinel是redis官方推荐的高可用性解决方案,当用redis作master-slave的高可用时,如果master本身宕机,redis本身或者客户端都没有实现主从切换的功能. 而 ...

  4. 更新Composer依赖报错处理Fatal error: Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRe

    更新Composer依赖报错处理 Fatal error: Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRe po ...

  5. hadoop生态搭建(3节点)-02.ssh配置

    # ssh免密码登录 # ==================================================================node1# 一路狂按回车,最终生成(id ...

  6. zookeeper环境搭建(Linux)

    安装zookeeper 安装jdk(此处省略) 解压tar包并配置变量环境 配置文件修改 将/usr/local/src/zookeeper-3.4.5/conf这个路径下的zoo_sample.cf ...

  7. Scrapy之Cookie和代理

    cookie cookie: 获取百度翻译某个词条的结果 一定要对start_requests方法进行重写. 两种解决方案: 1. Request()方法中给method属性赋值成post2. For ...

  8. count_char

    import java.util.Scanner; public class count_char { public static void main(String args[]) { int cou ...

  9. 004---Linux系统设置

    Linux版本相关命令 查看系统版本:cat /etc/redhat-release 查看系统内核版本以及位数:uname -r [root@hostname1 ~]# cat /etc/redhat ...

  10. python2.7入门---Number(数字)

        今天咱们来简单分享一下关于python中的一种数据类型和操作方法.费话不多说哈,咱们直接来进行实践加理论.首先,我们要知道,Python Number 数据类型用于存储数.数据类型是不允许改变 ...