所以我就想用一个既方便调用又方便更新的方法来实现,结果如愿以偿。先将此技术点总结如下:
在此之前我也寻找过目前网络上最流行的做法的实现方案,大体共总结出7种方法,但是发现他们的方法多多少少都存在缺陷,后来我自己做出了我自己觉得满意的方法。
先看目前网络上最流行的7种做法:
1,无图片纯css圆角框
收录理由:兼容性强,不用图形
图一
特点:
1.不用任何图形,使用很多个div容器模拟出圆角效果。
2.兼容性:通杀所有浏览器
缺点:
1.构造这个圆角需要加入太多的无语义的标签,结构比较冗余。
2.重用性不强:如果一个页面有多个圆角,并且要实现不同的半径大小,则其灵活性不够。
3.边框颜色虽然可以调节,但会对页面中的结构产生致命的影响,适用于色彩单一并且一个页面中圆角应用不多的页面。
4.不容易实现圆弧内有渐变色的图形背景。
5.圆角框不够圆滑,有锯齿现象,适合于背景色和当前色色差不大并且圆弧较小的网页。
实现原理:
用很多1像素高的div容器,利用背景色和边框色来模拟出圆角框的轮廓线。
实例演示: http://www.cssplay.co.uk/boxes/snazzy.html
2,无图片纯css圆角框,用特殊字符(&bull)
收录理由:圆滑,不用图形
图二
特点:
1.不用任何图形,使用特殊字符•(圆点)模拟出圆角。
2.兼容性:通杀所有浏览器
3.圆角平滑
缺点:
1.构造这个圆角一样需要加入无语义的标签,结构冗余,同第一种一样。
2.重用性不强:如果一个页面有多个圆角,并且要实现不同的半径大小,需要调整四个角图片的定位,并且字符大小对其有影响,灵活性不够。
3.颜色虽可调节,但要求里面的背景色和字符的颜色相同,不能做成边框线条。适用于色彩单一并且一个页面中圆角不是太多的页面。
4.一样不容易实现圆弧内有渐变色的图形背景。
实现原理:
用特殊字符(&bull),利用定位,截取四分之一圆模拟出圆角框的一个角图片。
实例演示:http://www.cssplay.co.uk/boxes/curves.html
3,图片圆角框
收录理由:兼容性强,可以表现很复杂的圆角效果。
图三
特点:
1.使用四个圆角图形(或一个圆图片)。
2.兼容性:通杀所有浏览器。
3.这是最常用的圆角框做法。
4.因为采用图片来表现,所以其圆角是超级平滑,无任何锯齿现象。
5.表现丰富,适用于各种对图片表现要求较高的圆角框。
缺点:
1.构造这个圆角也需要加入四个标签来装四张角图片,结构也有冗余。
2.重用性不强:如果一个页面有多个圆角,并且要实现不同的半径大小,则要重新制作一套圆角图片。
3.如果对结构的冗余没有特别的需求,这就是超级圆滑圆角框的解决方案了。
实现原理:
利用九宫格原理,在一个容器的四个角加入绝对定位(或相对定位)的四张圆角图片。
实例演示:http://www.cssplay.co.uk/boxes/three_cornered.html
4,利用VML绘制圆角(ie only)
收录理由:无图片,平滑,可加阴影边框
图四
特点:
1.不用任何图形。
2.兼容性:只能在IE中使用
3.圆角半径随意调整
4.重用性强:多个圆角任意调用。
5.圆角颜色随意设置。
6.结构无冗余。
7.圆角平滑无锯齿。
缺点:
1.除了兼容性 有问题外,其它方面的表现都不错。
2.不能在圆弧中表现丰富的有渐变的图片,因为圆弧外框是透明的。
实现原理:使用IE专用的VML来画出圆角。
id=”roundbox” class=”circle” strokecolor=”red” strokeweight=”2px” arcsize=”0.08″> v:roundrect > 注意加入引用空间: 这是兼容的用法,xmlns:v一定不能少,否则。。。 样式表中加入这一句话: v”:*{behavior:url(#default#VML);display:inline-block;} Arcsize为半径 Strokeweight为边框线宽度 Strokecolor为边框线的颜色 实例演示:(请在IE系列浏览器下查看本实例) 使用IE专用的VML来画平滑圆角框,还可以画出阴影效果。就其图形表现来说,是非常完美的。 收录理由:平滑无锯齿 图五 特点: 1.不用任何图形。 2.兼容性:只能在FF3中使用,其它浏览器不受支持。 3.圆角半径随意调整 4.重用性强:多个圆角任意调用,只需要样式表设置就可以。 5.圆角颜色随意设置。 6.结构无冗余。 7.圆角平滑无锯齿。 缺点: 1.除了兼容性 有问题外,其它方面的表现都不错,这种方式应该是最完美的方式,可惜目前只有FF3能支持这个属性,以后CSS3后会支持这个属性,不过这不知道要等到多少年以后。 2.同第五种圆角一样,在处理圆弧内的图片背景时显得有些有心无力。 实现原理: 使用FF3专用的私有属性来画出圆角。 只用两种属性就能体现圆滑的圆角框 -moz-border-radius:10px; Border:5px red solid; 实例演示:(请在FF3浏览器下观看,其它浏览器不支持) FF3下的圆角框两个属性就可以解决: -moz-border-radius:半径 border:边框 这种方案目前应该是比较完美的方案了。 图六 特点: 1.不用任何图形。 2.兼容性:通杀所有浏览器 3.圆角半径随意调整 4.重用性强:多个圆角任意调用。 5.颜色随意设置,并且可以使用复杂的图片做为背景,表现丰富。 6.结构无冗余,只需要在容器上定义一个class或ID就可以将这个div变成圆角。 7.圆角平滑。 缺点: 1.客户端禁用JS时就无圆角,不过在目前情势下,这种情况应该不会成为太大的问题。 实例演示:http://www.curvycorners.net/examples.php(有三个演示例子) 增补一种方案,结合jquery/vml/canvas的无图片圆角框。 图七 特点: 结语:目前的css因为不能为一个容器中定义多张背景图片,造成了为了这种圆角效果而加入冗余标签。听说CSS3会引入这一属性,可能到哪时,就是 圆角框统一的时候了。另外也听说在CSS3中有意向加入像FF3私有属性(-moz-border-radius)的方法,这也可以完美地解决这个问题。 但在目前的情势下,可能也只有用上面的这些方法来过渡了,强烈期待CSS3的到来。 In short: It is basically impossible to achieve an absolutely perfect rounded corner frame under the current situation, so it is named "semi-perfect solution". -------------------------------------------------- -------------------------------------------------- -------------------------------- My solution: CSS Jquery rounded corner image with four corners Step one: Go to the website http://jquery.com/ to download the jquery-1.3.2.min.js file, which will be referenced in the entire project. VML画平滑圆角
5,利用私有属性绘制圆角(FF3 only)
FF3私有属性画的圆角框
6,无图片脚本圆角框(js半完美解决方案)
7,无图片vml/canvas结合的圆角框
1.不用任何图形。
2.兼容性:通杀所有浏览器
3.圆角半径随意调整,并且四个角可以随意设置要不要圆角。
4.重用性强:多个圆角任意调用。
5.颜色随意设置,并且可以使用复杂的图片做为背景,表现丰富。
6.结构无冗余,只需要在容器上定义一个class或ID就可以了。
7.圆角平滑。
缺点:
1.本圆角需要用到jquery库,和一个JS文件,如果在您的项目中已经用到了Jquery这个库,倒还可以用得上,不然,为一个圆角加载一两个JS文件有点得不偿失。
2.圆角在不同的浏览器下显示有点小小的问题.
实例演示:http://labs.parkerfox.co.uk/cornerz/
About will be added to the page
Step 2: Write the Jquery method on the page where the rounded corner box needs to be implemented (Jquery is a framework technology of JS).
Source code:
JS code:
< ;script type="text/JavaScript">
$(".corner").prepend("
$(".corner").after("
Generated HTML code:
Step 3: Edit the CSS style to achieve the rounded corners you want.
Summary: As long as the source code of the DIV block with rounded corners is class="corner", by calling the JS code, you can generate the div tag that you want to have a rounded background with. No need Add those codes manually every time you make a rounded corner block, which makes the work simple and the source files clear and concise, making it convenient for developers and UI personnel.

JavaScript core data types are consistent in browsers and Node.js, but are handled differently from the extra types. 1) The global object is window in the browser and global in Node.js. 2) Node.js' unique Buffer object, used to process binary data. 3) There are also differences in performance and time processing, and the code needs to be adjusted according to the environment.

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
