为div中的像素着色 [英] Color a pixel in the div

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

问题描述

我不知道这是不是很棘手。

I don't know if it is tricky.

这里是 jsFiddle 简单< div> hello< / div>

谢谢。

推荐答案

您可以这样做:

div:before{
    position: absolute;
    width:1px;height:1px;
    background:red;
    content:'';
}
div {
    position: relative;
    border:1px solid green;
    height:200px;
    background-color:yellow;
}

演示(带有更大的红点,这很明显)

Demonstration (with a bigger red dot, so that it's obvious)

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

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