• 解决ie7不支持after、before的方法


    1、第一个步骤http://jquery.lukelutman.com/plugins/pseudo/ 下载 jq-pseudo.js
    下载好了,就引入jQuery和jq-pseudo.js
    2、书写选择器的语法:
    选择器:before, 选择器 {
      /*兼容IE6、IE7*/
       before: '要写的内容';
       /*兼容IE8*/
       content: '要写的内容';
    }
    对伪元素进行设置样式:
    选择器:before, 选择器 .before {
             书写样式       
    }
     
    demo:
     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 <html>
     3     <head>
     4         <title>Basic Example - jQuery Pseudo Plugin</title>
     5         <script type="text/javascript" src="jquery.js"></script>
     6         <script type="text/javascript" src="jquery.pseudo.js"></script>
     7         <script type="text/javascript">
     8             $(function(){
     9                 $('#on').bind('click', function(e){
    10                     $('body').addClass('toggle');
    11                     e.preventDefault();
    12                 });
    13                 $('#off').bind('click', function(e){
    14                     $('body').removeClass('toggle');
    15                     e.preventDefault();
    16                 });
    17             });
    18         </script>
    19         <style type="text/css">
    20     
    21             p:before, p {
    22                 before: 'foo ';
    23                 content: 'foo '; }
    24                 
    25             p:after, p {
    26                 after: ' bar';
    27                 content: ' bar'; }
    28         
    29             p:before, p .before {
    30                 color: blue; }
    31                 
    32             p:after, p .after {
    33                 color: red; }
    34         
    35         </style>
    36     </head>
    37     <body>
    38         <h1>Basic Example - jQuery Pseudo Plugin</h1>
    39         <p>&laquo; <a href="index.html">Back to the jQuery Pseudo Plugin</a></p>
    40         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    41         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    42         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    43     </body>
    44 </html>
  • 相关阅读:
    使用mail架包发送邮件javax.mail.AuthenticationFailedException: failed to connect at javax.mail.Service.connec
    java容器 Map Set List
    COJ 1686:记忆化搜索
    POJ 3694:桥
    COJ 1685:贪心+set
    COJ 1687:Set
    COJ 1684:线段树
    POJ 3693:RMQ+后缀数组
    URAL 1297:后缀数组求最长回文串
    POJ 1743:后缀数组
  • 原文地址:https://www.cnblogs.com/front-end-develop/p/5754213.html
Copyright © 2020-2023  润新知