热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Twitter的Bootstrap-表单输入太薄-Twitter'sBootstrap-FormInputsTooThin

ImusingTwittersBootstraptocreatetheHTMLCSSformywebsite.Irunintoaproblemwhencreat

I'm using Twitter's Bootstrap to create the HTML/CSS for my website. I run into a problem when creating the forms, however:

我正在使用Twitter的Bootstrap为我的网站创建HTML / CSS。但是,在创建表单时遇到问题:

screenshot of error

As you can see the inputs are too skinny for the text. I have tested with my own code, as well as copy/pasting the exact code from their documentation:

正如您所看到的那样,输入对于文本来说太瘦了。我已经使用自己的代码进行了测试,并从他们的文档中复制/粘贴了确切的代码:

http://twitter.github.com/bootstrap/base-css.html#forms

http://twitter.github.com/bootstrap/base-css.html#forms

I am including two resources:

我包括两个资源:



As far as I can tell they are loading correctly. Am I missing a resource?

据我所知,他们正确加载。我错过了资源吗?

5 个解决方案

#1


42  

Damnit. I was missing

该死的。我失踪了

 

at the top of the document.

在文档的顶部。

#2


6  

The fix did not work for me. But what helped was finding and removing following in our codebase:

<!DOCTYPE html>修复程序对我不起作用。但是在我们的代码库中找到并删除了以下内容有什么帮助:

*, *:before, *:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

#3


5  

I had this problem and drove me mad for hours as the cause was completely invisible. I already had the there and all the code was perfect. The problem turned out to be the text file encoding.

我遇到了这个问题并且让我疯了好几个小时因为原因是完全看不见的。我已经有了<!DOCTYPE html>,所有代码都很完美。问题原来是文本文件编码。

Using the linux 'file' command showed the source file coded as: "PHP script, UTF-8 Unicode (with BOM) text".
Running 'more' on the file showed some garbage chars () at the start of the files. I created new files within linux and copied/pasted the code in and everything started working as expected.

使用linux'file'命令显示源文件编码为:“PHP脚本,UTF-8 Unicode(带BOM)文本”。在文件上运行'more'会在文件开头显示一些垃圾字符()。我在linux中创建了新文件并复制/粘贴了代码,一切都按预期开始工作。

#4


2  

What fixed it for me was adding class="form-control" to the input.

为我修复的是在输入中添加class =“form-control”。

#5


-1  

Ok, I had the same problem and after weeks searching for a solution, this guy solved my problem!

好吧,我有同样的问题,经过几周寻找解决方案,这家伙解决了我的问题!

getting application.css to override bootstrap

让application.css覆盖bootstrap

1 - create the file assets/stylesheets/my_styles.css.scss

1 - 创建文件assets / stylesheets / my_styles.css.scss

2 - put the code bellow in my_styles.css.scss file:

2 - 将代码放在my_styles.css.scss文件中:

input[type=text], input[type=password], input[type=email], input[type=tel] {
height: 33px !important;}

3 - In assets/stylesheets/application.css, put this:

3 - 在assets / stylesheets / application.css中,输入:

*= require my_styles   

after bootstraps require... in my case it is:

在bootstraps需要之后...在我的情况下它是:

*= require font-awesome
*= require bootstrap_sb_admin_base_v2
*= require_self
*= require my_styles
*= require_tree .
*/   

Hope it helps someone in trouble!

希望它可以帮助陷入困境的人!


推荐阅读
author-avatar
惰堂_301
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有