css如何制作动画效果
CSS制作三角形广告引导文字效果街上经常碰到一些发各类广告传单的,有一次收到一张房地产广告的传单,顺手留下来,看着里面有些广告挺吸引人,同时也想练练自己css技术,故抽空做了一下。
原图某区域如下:
实现上图效果是需要一些想象力的,比如三角形的构成和左右两边的空白间距,懂的这个原理,然后熟练运用border属性,一切就OK了
比如其中一个三角形
- <li class="arrow_ltitle1">
- </li>
- li.arrow_ltitle1 {
- width: 0;
- height: 0;
- border-top: 35px solid white;
- border-bottom: 35px solid white;
- border-left: 25px solid #68C339;
- }
HTML代码如下:
- <li class="fl arrow_shadow">
- <li class="arrow_lcontent1 fl">
- <li style="margin-top: 10px">
- <li>
- 低容积率</li>
- <li>
- <b style="font-size: 15pt">仅2.8</b></li>
- </li>
- </li>
- <li class="arrow_ltitle1 fl">
- </li>
- <li class="arrow_rtitle1 fl">
- <li class="arrow_rcontent1">
- <li>
- 同样的地块,那里建了10栋楼,这里仅仅7栋,居住舒适度你懂得!</li>
- </li>
- </li>
- </li>
- <li class="fr arrow_shadow">
- <li class="arrow_lcontent2 fl">
- <li style="margin-top: 10px">
- <li>
- 低建筑密度</li>
- <li>
- <b style="font-size: 12pt">仅23.51%</b></li>
- </li>
- </li>
- <li class="arrow_ltitle2 fl">
- </li>
- <li class="arrow_rtitle2 fl">
- <li class="arrow_rcontent2" style="margin-top: 8px">
- <li>
- 最大栋距达到近200米,</li>
- <li>
- 视觉空间超乎想象!</li>
- </li>
- </li>
- </li>
- <li class="empty10">
- </li>
- <li class="fl arrow_shadow">
- <li class="arrow_lcontent3 fl">
- <li style="margin-top: 13px">
- <li>
- 建材用的贵</li>
- <li>
- 品质有保障</li>
- </li>
- </li>
- <li class="arrow_ltitle3 fl">
- </li>
- <li class="arrow_rtitle3 fl">
- <li class="arrow_rcontent3">
- <li>
- 含钢量超出市场同类产品约30%,品质有保障,给您一个五星级的家。</li>
- </li>
- </li>
- </li>
- <li class="fr arrow_shadow">
- <li class="arrow_lcontent4 fl">
- <li style="margin-top: 5px">
- <li>
- 临江</li>
- <li>
- 瞰岛</li>
- <li>
- 官佛</li>
- </li>
- </li>
- <li class="arrow_ltitle4 fl">
- </li>
- <li class="arrow_rtitle4 fl">
- <li class="arrow_rcontent4">
- <li>
- 远离噪音污染,</li>
- <li>
- 与佛相伴修生养性;</li>
- <li>
- 上风上水财运滚滚!</li>
- </li>
- </li>
- </li>
- <li class="empty10">
- </li>
- <li class="fl arrow_shadow">
- <li class="arrow_lcontent5 fl">
- <li style="margin-top: 5px">
- <li>
- 贴近自然</li>
- <li>
- 畅想都市</li>
- <li>
- 慢生活</li>
- </li>
- </li>
- <li class="arrow_ltitle5 fl">
- </li>
- <li class="arrow_rtitle5 fl">
- <li class="arrow_rcontent5">
- <li>
- 太阳岛一墙之隔,</li>
- <li>
- 大佛景区近在咫尺,</li>
- <li>
- 远离都市尾气生活!</li>
- </li>
- </li>
- </li>
- <li class="fr arrow_shadow">
- <li class="arrow_lcontent6 fl">
- <li style="margin-top: 13px">
- <li>
- 买房装修</li>
- <li>
- 一步到位</li>
- </li>
- </li>
- <li class="arrow_ltitle6 fl">
- </li>
- <li class="arrow_rtitle6 fl">
- <li class="arrow_rcontent6">
- <li>
- 四川家装连锁品牌芙蓉锦城提供多种精装套餐服务,实体样板呈现,恭迎品鉴</li>
- </li>
- </li>
- </li>
CSS样式如下:
- body{font-family: 微软雅黑; padding:0; margin:0px auto; width:700px; }
- .fl{float: left;}
- .fr{float: rightright;}
- .empty10{ height:20px; clear:both}
- .shadow{-moz-box-shadow: 0 0 20px #777676;box-shadow: 0 0 20px #777676; padding: 5px; background: white;}
- .arrow_shadow{-moz-box-shadow: 5px 5px 10px #B7B7B7; box-shadow: 5px 5px 10px #B7B7B7;}
- /*第1个广告样式*/
- li.arrow_ltitle1{width: 0; height: 0;border-top: 35px solid white;border-bottom: 35px solid white; border-left: 25px solid #68C339;}
- li.arrow_rtitle1{ position: relative; width: 0;height: 0; border-top: 35px solid #68C339; border-right: 210px solid #68C339; border-bottom: 35px solid #68C339; border-left: 25px solid white;}
- li.arrow_lcontent1{text-align: center; width: 80px; height: 70px;background: #68C339;color: white;font-size: 15px;}
- li.arrow_rcontent1{color: white;position: absolute;left: 10px;top: -30px;width: 180px;font-size: 15px;}
- /*第2个广告样式*/
- li.arrow_ltitle2{width: 0; height: 0;border-top: 35px solid white;border-bottom: 35px solid white; border-left: 25px solid #E2B32E;}
- li.arrow_rtitle2{ position: relative; width: 0;height: 0; border-top: 35px solid #E2B32E; border-right: 210px solid #E2B32E; border-bottom: 35px solid #E2B32E; border-left: 25px solid white;}
- li.arrow_lcontent2{text-align: center; width: 80px; height: 70px;background: #E2B32E;color: white;font-size: 15px;}
- li.arrow_rcontent2{color: white;position: absolute;left: 10px;top: -30px;width: 180px;font-size: 15px;}
- /*第3个广告样式*/
- li.arrow_ltitle3{width: 0; height: 0;border-top: 35px solid white;border-bottom: 35px solid white; border-left: 25px solid #4381CE;}
- li.arrow_rtitle3{ position: relative; width: 0;height: 0; border-top: 35px solid #4381CE; border-right: 210px solid #4381CE; border-bottom: 35px solid #4381CE; border-left: 25px solid white;}
- li.arrow_lcontent3{text-align: center; width: 80px; height: 70px;background: #4381CE;color: white;font-size: 15px;}
- li.arrow_rcontent3{color: white;position: absolute;left: 10px;top: -30px;width: 180px;font-size: 15px;}
- /*第4个广告样式*/
- li.arrow_ltitle4{width: 0; height: 0;border-top: 35px solid white;border-bottom: 35px solid white; border-left: 25px solid #9C2E8F;}
- li.arrow_rtitle4{ position: relative; width: 0;height: 0; border-top: 35px solid #9C2E8F; border-right: 210px solid #9C2E8F; border-bottom: 35px solid #9C2E8F; border-left: 25px solid white;}
- li.arrow_lcontent4{text-align: center; width: 80px; height: 70px;background: #9C2E8F;color: white;font-size: 15px;}
- li.arrow_rcontent4{color: white;position: absolute;left: 10px;top: -30px;width: 180px;font-size: 15px;}
- /*第5个广告样式*/
- li.arrow_ltitle5{width: 0; height: 0;border-top: 35px solid white;border-bottom: 35px solid white; border-left: 25px solid #403D6F;}
- li.arrow_rtitle5{ position: relative; width: 0;height: 0; border-top: 35px solid #403D6F; border-right: 210px solid #403D6F; border-bottom: 35px solid #403D6F; border-left: 25px solid white;}
- li.arrow_lcontent5{text-align: center; width: 80px; height: 70px;background: #403D6F;color: white;font-size: 15px;}
- li.arrow_rcontent5{color: white;position: absolute;left: 10px;top: -30px;width: 180px;font-size: 15px;}
- /*第6个广告样式*/
- li.arrow_ltitle6{width: 0; height: 0;border-top: 35px solid white;border-bottom: 35px solid white; border-left: 25px solid #EA6F05;}
- li.arrow_rtitle6{ position: relative; width: 0;height: 0; border-top: 35px solid #EA6F05; border-right: 210px solid #EA6F05; border-bottom: 35px solid #EA6F05; border-left: 25px solid white;}
- li.arrow_lcontent6{text-align: center; width: 80px; height: 70px;background: #EA6F05;color: white;font-size: 15px;}
- li.arrow_rcontent6{color: white;position: absolute;left: 10px;top: -30px;width: 180px;font-size: 15px;}
以上就是本文的全部内容,希望对大家的学习有所帮助。