CSS中expression/pseudo-class

IE5及其以后版本支持在CSS中使用expression,用来把CSS属性和Javascript表达式关联起来,这里的CSS属性可以是元素固有的属性,也可以是自定义属性。就是说CSS属性后面可以是一段Javas cript表达式,CSS属性的值等于Javascript表达式计算的结果。 在表达式中可以直接引用元素自身的属性和方法,也可以使用其他浏览器对象。

  固有属性赋值

  例如,你可以依照浏览器的大小来安置一个元素的位置。

#myDiv {
position: absolute;
width: 100px;
height: 100px;
left: expression(document.body.offsetWidth - 110 + "px");
top: expression(document.body.offsetHeight - 110 + "px");
background: red;
}

#myTable tbody tr {
line-height: 24px;
background-color:expression((this.sectionRowIndex%2==0)?"#F4F8FF":"#E6EFF7");
}
  自定义属性赋值

  例如,消除页面上的链接虚线框。 通常的做法是:

<a href="link1.htm" οnfοcus="this.blur()">link1</a>
<a href="link2.htm" οnfοcus="this.blur()">link2</a>
<a href="link3.htm" οnfοcus="this.blur()">link3</a>

  采用expression的做法如下:

<style type="text/css">
a {star : expression(οnfοcus=this.blur)}
</style>
<a href="link1.htm">link1</a>
<a href="link2.htm">link2</a>
<a href="link3.htm">link3</a>

  说明:里面的star就是自己任意定义的属性,你可以随自己喜好另外定义,接着包含在expression()里的语句就是JS脚本,在自定义属性与expression之间可别忘了还有一个分号,因为实质还是CSS,所以放在style标签内,而非script内。这样就很容易地用一句话实现了页面中的链接虚线框的消除。不过你先别得意,如果触发的特效是CSS的属性变化,那么出来的结果会跟你的本意有差别。例如你想随鼠标的移进移出而改变页面中的文本框颜色更改,你可能想当然的会认为应该写为

<style type="text/css">
input
{star : expression(οnmοuseοver=this.style.backgroundColor="#FF0000";
οnmοuseοut=this.style.backgroundColor="#FFFFFF")}
</style>
<style type="text/css">
input {star : expression(οnmοuseοver=this.style.backgroundColor="#FF0000";
οnmοuseοut=this.style.backgroundColor="#FFFFFF")}
</style>
<input type="text">
<input type="text">
<input type="text">

  可结果却是出现脚本出错,正确的写法应该把CSS样式的定义写进函数内,如下所示:

<style type="text/css">
input {star : expression(οnmοuseοver=function()
{this.style.backgroundColor="#FF0000"},
οnmοuseοut=function(){this.style.backgroundColor="#FFFFFF"}) }
</style>
<input type="text">
<input type="text">
<input type="text">

附滚动条定义

body {
margin: 0px;
background-color: #F4F8FF;
scrollbar-face-color:#F4F8FF;
scrollbar-highlight-color:#788DB4;
scrollbar-shadow-color:#788DB4;
scrollbar-3dlight-color:#CFE3F3;
scrollbar-arrow-color:#9BC8ED;
scrollbar-track-color:#F4F8FF;
scrollbar-darkshadow-color:#CFE3F3;
}

细边框表格
table {
border-collapse:collapse; /* 关键属性:合并表格内外边框*/
border:solid #999; /* 设置边框属性;样式(solid=实线)、颜色(#999=灰) */
border-width:1px 0 0 1px; /* 设置边框状粗细:上 右 下 左 = 对应:1px 0 0 1px */
}
table caption {font-size:14px;font-weight:bolder;}
table th,table td {
border:solid #999;border-width:0 1px 1px 0;padding:2px;
/* border-right:expression((this.cellIndex!=5) ? "1px solid #9BC2E0": "0px");
border-bottom:1px solid #9BC2E0;
border-left: 0px;
border-top: 0px;
height: 22pt;
*/
}
tfoot td {text-align:center;}

CSS对打印的控制:
<!--media=print 这个属性可以在打印时有效-->
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
Noprint样式可以使页面上的打印按钮等不出现在打印页面上,PageNext样式可以设置分页,在需要分页的地方<div class="PageNext"></div>就OK了。

图片尺寸控制:
img{width:expression(this.width>500?"500px":this.width+"px"); }

[b]pseudo-class伪类:[/b]
1.锚的伪类
a:link {color: #FF0000; text-decoration: none} /* 未访问的链接 */ 
a:visited {color: #00FF00; text-decoration: none} /* 已访问的链接 */
a:hover {color: #FF00FF; text-decoration: underline} /* 鼠标在链接上 */
a:active {color: #0000FF; text-decoration: underline} /* 激活链接 */
a.red:link {color: #FF0000}
a.red:visited {color: #0000FF}
a.blue:link {color: #00FF00}
a.blue:visited {color: #FF00FF}

定义这些链接样式时,一定要按照a:link, a:visited, a:hover, a:actived的顺序书写。
2.首字和首行(first-letter和first-line)伪类
p:first-letter {font-size: 300%}
div:first-line {color: red}

3.li中使用以块级显示元素

#my li{
margin-left:52%;
}
#my li a{
display:inline-block;
width:70%;
overflow:hidden;
white-space:nowrap;

}
#my li i{
width:30%;
display:inline-block;
text-align:center;
}


网站变成黑白(IE):

html{filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale='1');}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目标检测(Object Detection)是计算机视觉领域的一个核心问题,其主要任务是找出图像所有感兴趣的目标(物体),并确定它们的类别和位置。以下是对目标检测的详细阐述: 一、基本概念 目标检测的任务是解决“在哪里?是什么?”的问题,即定位出图像目标的位置并识别出目标的类别。由于各类物体具有不同的外观、形状和姿态,加上成像时光照、遮挡等因素的干扰,目标检测一直是计算机视觉领域最具挑战性的任务之一。 二、核心问题 目标检测涉及以下几个核心问题: 分类问题:判断图像的目标属于哪个类别。 定位问题:确定目标在图像的具体位置。 大小问题:目标可能具有不同的大小。 形状问题:目标可能具有不同的形状。 三、算法分类 基于深度学习的目标检测算法主要分为两大类: Two-stage算法:先进行区域生成(Region Proposal),生成有可能包含待检物体的预选框(Region Proposal),再通过卷积神经网络进行样本分类。常见的Two-stage算法包括R-CNN、Fast R-CNN、Faster R-CNN等。 One-stage算法:不用生成区域提议,直接在网络提取特征来预测物体分类和位置。常见的One-stage算法包括YOLO系列(YOLOv1、YOLOv2、YOLOv3、YOLOv4、YOLOv5等)、SSD和RetinaNet等。 四、算法原理 以YOLO系列为例,YOLO将目标检测视为回归问题,将输入图像一次性划分为多个区域,直接在输出层预测边界框和类别概率。YOLO采用卷积网络来提取特征,使用全连接层来得到预测值。其网络结构通常包含多个卷积层和全连接层,通过卷积层提取图像特征,通过全连接层输出预测结果。 五、应用领域 目标检测技术已经广泛应用于各个领域,为人们的生活带来了极大的便利。以下是一些主要的应用领域: 安全监控:在商场、银行
ERROR: Bitbake Fetcher Error: FetchError('Fetch command export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus,guid=d96498d849b66a7ed5ae1643647dc969"; export SSH_AGENT_PID="1854"; export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh"; export PATH="/home/wu/3568/yocto/poky/scripts/native-intercept:/home/wu/3568/yocto/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/recipe-sysroot-native/usr/bin/python3-native:/home/wu/3568/yocto/poky/scripts:/home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/recipe-sysroot-native/usr/bin/x86_64-linux:/home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/recipe-sysroot-native/usr/bin:/home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/recipe-sysroot-native/usr/sbin:/home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/recipe-sysroot-native/usr/bin:/home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/recipe-sysroot-native/sbin:/home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/recipe-sysroot-native/bin:/home/wu/3568/yocto/poky/bitbake/bin:/home/wu/3568/yocto/build/tmp/hosttools"; export HOME="/home/wu"; git -c core.fsyncobjectfiles=0 -c gc.autoDetach=false -c core.pager=cat clone -n -s /home/wu/3568/yocto/build/../packages/git2/github.com.intel.bmap-tools/ /home/wu/3568/yocto/build/tmp/work/x86_64-linux/bmap-tools-native/3.6+gitAUTOINC+c0673962a8-r0/git/ failed with exit code 128, output:\nfatal: repository \'/home/wu/3568/yocto/build/../packages/git2/github.com.intel.bmap-tools/\' does not exist\n', None)具体如何修改
06-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值