Rails 中的背景图像 [英] background image in rails

查看:36
本文介绍了Rails 中的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Rails 3.2.9,我想放一张背景图片.我的图像在文件夹中找到:public/images,我也把它放在文件夹中:assets/images.

I have rails 3.2.9 and I want to put a background image. my image is found in the folder: public/images and I put it also in the folder: assets/images.

ul { 
    height: 200px; 
    width: 350px; 
    border: solid 1px blue; 
    margin: 0 auto; 
    padding: 0px;
    background-image: url('/images/todo.png'); 
}

但是没有背景图像.请帮忙.

but there is no backgound image. please help.

推荐答案

我必须放:

background-position: center;

所以我的代码是:

background: url(/assets/rsz_todo.png) no-repeat;
background-position: center;

并且我的图像位于 assets/images

这篇关于Rails 中的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆