gpt4 book ai didi

html - 如何在 ruby​​ on rails 中 float 我的图像标签?

转载 作者:太空宇宙 更新时间:2023-11-04 13:02:53 24 4
gpt4 key购买 nike

我想将 logo.png float 到左侧,但它不起作用。这是我的 Rails 代码:

<!DOCTYPE html>
<html>
<head>
<title>Pragprog Books Online Store</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body class="<%= controller.controller_name %>">
<div id="banner">
<%= image_tag ("logo.png") %> <----------- can't move this thing!
<%= @page_title || "Pragmatic Bookshelf"%>
</div>
<div id ="columns">
<div id="side">
<ul>
<li><a href="http://www......">Home</a></li>
<li><a href="http://www......">Questions</a></li>
<li><a href="http://www......">News</a></li>
<li><a href="http://www......">Contact</a></li>
</ul>
</div>
<div id="main">
<%= yield %>
</div>
</div>
</body>
</html>

这是 CSS:

#banner {
background: #9c9;
padding: 10px;
border-bottom: 2px solid;
font: small-caps 40px/40px "Times New Roman", serif;
color: #282;
text-align: center;
img {
float: left;
}
}

我正在研究代码,但我似乎根本无法操纵图像。环顾四周寻找遗漏之类的东西,但找不到任何东西。我错过了什么?感谢您的帮助!

最佳答案

#banner {
background: #9c9;
padding: 10px;
border-bottom: 2px solid;
font: small-caps 40px/40px "Times New Roman", serif;
color: #282;
text-align: center;
}
#banner img {
float: left;
}
#banner h1 {
text-align:center
}

当然这只是一个近似值,您需要进行调整,但请查看 this fiddle查看它是如何完成的并根据需要进行更改

关于html - 如何在 ruby​​ on rails 中 float 我的图像标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25336728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com