使用CSS浮动div [英] Floating div using css

查看:46
本文介绍了使用CSS浮动div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中需要这种效果.左上角有一个浮动的红色色带.但是我想使用CSS实现它的图像.请参考下图

i need this kind of effect in my project. there is a left corner floating red color strip. but i want to implement it for image using css. Please refer below image

http://www.w3.org/TR/xhtml2/mod-tables.html#sec_26.6.1 .

推荐答案

您可以将 position:fixed; 用于div.

示例代码

css

 #redBar {width:40px; height:200px; position:fixed; background:red;}

html

<div id="redBar"></div>

演示 http://jsbin.com/aqofa5

您可以修改 background 属性以添加自定义背景图片,例如 background:url("the-path-for-the-image")).

You can modify the background property to add your custom background image like background:url("the-path-for-the-image").

这篇关于使用CSS浮动div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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