bootstrap显示带灰色文本的按钮

bootstrap显示带灰色文本的按钮

本文介绍了Twitter bootstrap显示带灰色文本的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Ruby on Rails应用程序上使用Twitter Bootstrap作为框架。

I'm using Twitter Bootstrap as a framework on my Ruby on Rails application.

我使用 link_to 以生成样式为按钮的链接,具有以下CSS类:btn btn-primary btn-mini。

I use link_to to generate links that are styled as buttons, with the following CSS classes: "btn btn-primary btn-mini".

例如:

<%= link_to 'New Event', url_for(:action => 'new', :controller => 'events') , :class => "btn btn-primary btn-mini" %>

生成以下html

<a href="/events/new" class="btn btn-primary btn-mini">New Event</a>

按钮显示正确,但按钮文字显示为灰色而不是白色。功能上它工作正常,它不禁用等。当鼠标悬停在按钮上方时,文本也会变为白色。

The button displays correctly, but the button text is displayed in grey instead of white. Functionally it works fine, it's not disabled or so. The text also turns white when the mouse hovers over the button.

我测试了几种情况。我的结论是,无论何时生成的(或硬编码)链接以正斜杠(/)开始,按钮文本是灰色的。每当它以相对资源开始

I tested a few cases. What I concluded in is that whenever the generated (or hardcoded) link starts with a forward slash (/) the button text is greyed. Whenever it starts with a relative resource

我运行Rails 3.2.2,并使用最新的twitter-bootstrap-gem。

I'm running Rails 3.2.2, and using the latest twitter-bootstrap-gem.

我如何解决这个问题?

推荐答案

Scaffold.css会导致这个。

Did you run a scaffold generator? Scaffold.css will cause this. If you remove it you'll be good to go.

您也可以使用--skip样式表运行生成器,以防止创建

You can also run the generator with --skip-stylesheets to prevent them being created

这篇关于Twitter bootstrap显示带灰色文本的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 05:52