请问哪位高手知道,如下CSS如何写?

html-css012

请问哪位高手知道,如下CSS如何写?,第1张

<style type="text/css">

        .triangle{

            position:absolute

            left:2px

            top:24px

            width:0

            height:0

            border-right:16px #ededed solid

            border-left:none

            border-top:8px rgba(0, 0, 0, 0) solid

            border-bottom:8px rgba(0, 0, 0, 0) solid

            z-index:1002

        }

        .paopao{

            position:absolute

            left:16px

            top:8px

            width:512px

            height:101px

            background-color: #ededed

            border:1px #d5d5d5 solid

            border-radius:12px

            box-shadow:inset 0 2px 2px rgba(255, 255, 255, 1), inset 0 -2px 2px rgba(0, 0, 0, 0.1)

            z-index:1001

        }

</style>

<div class="triangle"></div>

<div class="paopao"></div>

纯粹CSS实现的话,需要CSS3支持,也就是用Chrome、FireFox、IE9以上浏览器,效果如下:

jQuery mobile 做一个泡泡框的实现方法:

思路:用jquery内置的SetBubblePopup方法形成泡泡即可。

核心代码:

//设置布局

$('#dummy2').SetBubblePopup({ 

innerHtml: '<p>Bubble Popup!</p>',

bubbleAlign: 'left',

tailAlign: 'left',

color: 'green',

contentStyle: 'font-size:16px'

})

//设定弹出第二个泡泡的样式和文字

jQuery().SetBubblePopup({

cssClass: [ ".myclass" ],

relAttribute: [ "nofollow" ],

innerHtml: '<p>another Bubble Popup!</p>',

bubbleAlign: 'right',

tailAlign: 'right',

color: 'violet',

contentStyle: 'color:#CC0066font-family:Arialfont-size:11pxfont-weight:bold'

})

效果如下:

CSS样式分为:内联式css样式、嵌入式css样式、外部式css样式。

对CSS三种样式定义及其实例:

内联式css样式。

内联式css样式表就是把css代码直接写在现有的HTML标签中,如下面代码:

1   <p style="color:red">这里文字是红色。</p>   

css样式代码要写在style=""双引号中,如果有多条css样式代码设置可以写在一起,中间用分号隔开(英文状态下)。

嵌入式css样式。

嵌入式css样式,就是可以把css样式代码写在标签之间。如下面代码实现把三个标签中的文字设置为红色:

1   <style type="text/css">span{color:red}</style>   

嵌入式css样式必须写在之间,并且一般情况下嵌入式css样式写在之间。

外部式css样式。

外部式css样式(也可称为外联式)就是把css代码写一个单独的外部文件中,这个css样式文件以“.css”为扩展名(也可以为调用其他网站CSS)。

1   <link href="style.css" rel="stylesheet" type="text/css" />   

注意事项: 1、css样式文件名称以有意义的英文字母命名,如 main.css。 2、rel=”stylesheet” type=”text/css” 是固定写法不可修改。 3、标签位置一般写在标签之内。

掌握好三种CSS三种样式使用方法在Web开发中将节省很多时间。