样式杂

本文介绍如何使用CSS自定义超链接的各种状态样式,包括默认、悬停、活动及访问后的样式,并展示了如何让LinkButton控件显示数据源内容,实现鼠标悬停时的手型光标效果,以及解决文本过长时的省略显示问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

1. 不同的超链接样式 

2. LIinkButton等控件的Text显示为数据源内容

3. 鼠标滑过出现小手

4. 文本过长显示省略点

 

 

1. 不同的超链接样式 

<style type="text/css">
        a
        {
            color: red;
            text-decoration: underline;
        }
        a:link
        {
            color:yellow;
            text-decoration: underline;
        }
        a:visited
        {
            color: black;
            text-decoration: underline;
        }
        a:hover
        {
            color: red;
            text-decoration: underline;
        }
        a:active
        {
            color: green;
            text-decoration: underline;
        }
       
       
        a.MyCalendar
        {
            color: Black;
            text-decoration: none;
        }
        a.MyCalendar:link
        {
            color:Black;
            text-decoration: none;
        }
        a.MyCalendar:visited
        {
            color: Black;
            text-decoration: none;
        }
        a.MyCalendar:hover
        {
            color: Black;
            text-decoration: none;
        }
        a.MyCalendar:active
        {
            color: Black;
            text-decoration: none;
        }
    </style>

<asp:LinkButton ID="LBtnDay1" Text="<%#Bind('Column1')%>" runat="server" CssClass="MyCalendar"></asp:LinkButton>

2. LIinkButton等控件的Text显示为数据源内容

<asp:LinkButton ID="LBtnDay1" Text="<%#Bind('Column1')%>" runat="server" CssClass="MyCalendar"></asp:LinkButton>

3. 鼠标滑过出现小手

Label lbl = e.Row.FindControl("LblDay1") as Label;
lbl.Attributes.Add("onmouseover", "this.style.cursor='hand'");

 4. 文本过长显示省略点

外层table样式:

table-layout:fixed;

 

td样式:

text-overflow: ellipsis;
 overflow: hidden;
 white-space: nowrap;

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值