填充div 2种颜色? [英] fill div with 2 colors?

查看:563
本文介绍了填充div 2种颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定一个宽500像素的div,有没有办法使用css填充2种不同的颜色的背景?我知道它可以做一个背景图像,但只是想知道是否可以做到与bg颜色。
eg:

 

code> div.twocolorish {
background-color:green;
border-left:20px solid red;
}

只要您不需要文字那么这将照顾你在一个div。


given a div that is 500px wide, is there a way to fill the background with 2 different colors using css? I know it can be done with a background image, but just wondering if it can be done with bg color. eg :

解决方案

You can't set multiple background colors, but you could set something like:

div.twocolorish {
    background-color: green;
    border-left: 20px solid red;
}

As long as you don't need text to go over the part in red then this would take care of you in one div.

这篇关于填充div 2种颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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