Maison > interface Web > tutoriel HTML > le corps du texte

DIV+CSS制作斜线效果记录_html/css_WEB-ITnose

WBOY
Libérer: 2016-06-24 11:31:17
original
1055 Les gens l'ont consulté

DIV+CSS 斜线效果很简单,只需设置一下CSS Border 的边框就能有斜线效果。代码分享给大家,你可以自己变通。

  提示要注意两点:1、DIV宽高的定义。2、DIV在 IE6 中默认是有高度的。

  上图右边是我们要实现的效果,代码如下:

1

2

3

4

5

6

7

8

9

10

11

12

 

#box{

     width : 0px ; height : 0px ;

     border : 40px  solid  #000 ;

     border-top-color : #930 ;

     border-bottom-color : #0C3 ;

     border-left-color : #FC0 ;

     border-right-color : #009 ;

}

  在FF IE7 IE8 都显示正常,但在IE6中,却如上图左边所示,中间有差距,因此,需要加一行:

  line-height:0px;

  最终代码如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

 

#box{

 

     width : 0px ; height : 0px ;

     border : 40px  solid  #000 ;

     border-top-color : #930 ;

     border-bottom-color : #0C3 ;

     border-left-color : #FC0 ;

     border-right-color : #009 ;

     line-height : 0px ;

}

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!