Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试这样做:
%p{:style=>"display:none;"} %h4= t("labels.shortened_urls.fqdn_url") =f.url_field :fqdn_url, {:readonly => true} %small=link_to((t "links.shortened_urls.view"), :target => :_blank)
但我无法让它停止显示。那里的第一行有什么我做的不对吗?
谢谢!
您的 Haml 是正确的,因为它正确生成了样式属性,但您的 HTML 是错误的。h4不允许元素作为元素的直接子元素,因此浏览器会p隐式关闭. 实际上你有一个空的,它已经设置了。ph4pdisplay:none
h4
p
display:none
尝试将 更改p为 a div,这是允许h4作为孩子的。(您可能也想更改其他内容)。
div