html链接外部css样式表,html – 仅针对特定Div 链接外部CSS文件

参见英文答案 >

Limit scope of external css to only a specific element?                                    4个

我需要为特定的DIV链接外部CSS文件

我有3个外部CSS文件

main.css

bootstrap.css

style.css

我需要将style.cssfile链接到特定的div< div class =“leftmenu”>

我如何链接到该div

我如何将style.css文件链接到< div class =“leftmenu”>

style.css文件

ul

{

margin:0px;

padding:0px;

list-style-type:none;

-webkit-backface-visibility: hidden; backface-visibility: hidden;

}

.var_nav

{

position:relative;

background:#ccc;

width:300px;

height:70px;

margin-bottom:5px;

}

.link_bg

{

width:70px;

height:70px;

position:absolute;

background:#E01B6A;

color:#fff;

z-index:2;

}

.link_bg i

{

position:relative;

}

.link_title

{

position:absolute;

width:100%;

z-index:3;

color:#fff;

}

.link_title:hover .icon

{

-webkit-transform:rotate(360deg);

-moz-transform:rotate(360deg);

-o-transform:rotate(360deg);

-ms-transform:rotate(360deg);

transform:rotate(360deg);

}

.var_nav:hover .link_bg

{

width:100%;

background:#E01B6A;

-webkit-transition: all 0.3s ease-in-out;

-moz-transition: all 0.3s ease-in-out;

-o-transition: all 0.3s ease-in-out;

-ms-transition: all 0.3s ease-in-out;

transition: all 0.3s ease-in-out;

}

.var_nav:hover a

{

font-weight:bold;

-webkit-transition:all .5s ease-in-out;

-moz-transition:all .5s ease-in-out;

-o-transition:all .5s ease-in-out;

-ms-transition:all .5s ease-in-out;

transition:all .5s ease-in-out;

}

.icon

{

position:relative;

width:70px;

height:70px;

text-align:center;

color:#fff;

-webkit-transition:all .5s ease-in-out;

-moz-transition:all .5s ease-in-out;

-o-transition:all .5s ease-in-out;

-ms-transition:all .5s ease-in-out;

float:left;

transition:all .5s ease-in-out;

float:left;

}

.icon i{top:22px;position:relative;}

a{

display:block;

position:absolute;

float:left;

font-family:arial;

color:#fff;

text-decoration:none;

width:100%;

height:70px;

text-align:center;

}

span

{

margin-top:25px;

display:block;

}

我检查了以下链接example但它的小知识可以帮助我如何将css文件链接到div

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值