Table of Contents
牛腩新闻发布系统后台登录
,在这个正常流中

这个部分的宽度比较大,把左右两边的正常流的边给撑开了,所以出现了断线的部分。那么只要把

的部分从正常流中拿走就可以改正这个缺点,对,就是float属性,下面的效果是经过我半个下午2个小时的不断调试,最终形成的结果:

Home Web Front-end HTML Tutorial 纯CSS制作圆角矩形框知识总结_html/css_WEB-ITnose

纯CSS制作圆角矩形框知识总结_html/css_WEB-ITnose

Jun 24, 2016 am 11:38 AM

    在制作后台登录页的时候,需要从网页上面把那个圆角矩形框选取下来,然后通过Photoshop进行切割,在进行设置,最后得到需要的登录框的圆角矩形框。如下图。


    但是登录最新的智囊团的那个登录页面的时候,上面的那个圆角矩形框已经没有了,最新的登陆页面跟QQ邮箱登录页面一样,没有了圆角矩形框。所以我就想到了用css自己堆出来一个圆角矩形框,通过查找资料,以及自己的一些使用方法的改进,最终得到了自己所需要的圆角矩形框??纯CSS设计圆角矩形框。

下面讲一下思路:圆角矩形框的难点就在于如何把那个圆角表示出来,其实我们把那个圆角的地方放大一下就会发现,所谓的圆角并不是严格的圆角,只是由于线条看起来比较和谐,那个圆角其实也是直角的框的那个直角。


这就是一个放大了的圆角矩形框,可以看到圆角的具体构成。

明白了原理,下面是代码的实现部分,非常简单:

<span style="font-family:KaiTi_GB2312;font-size:24px;">            <div class="divbox">                <div class="div1"></div>                <div class="div2"></div>                <div class="divmiddle">                   主要内容                </div>                <div class="div2"></div>                <div class="div1"></div>            </div></span>
Copy after login
<span style="font-family:KaiTi_GB2312;font-size:24px;">/*圆角框的制作-CSS代码部分*/.divbox {    width: 580px;     }/*.div1 .div2 .divmiddle{    float :right  ;}*/.div1 {    background: #999999;    border-left: #999999 solid 3px;    border-right: solid 3px #999;    margin: 0px 6px;    height: 3px;    overflow: hidden;}.div2 {    background: #FFF;    border-left: #999999 solid 3px;    border-right: solid 3px #999;    margin: 0px 2px;    height: 3px;    overflow: hidden;}.divmiddle {    height: 285px;    border-left: #999999 solid 3px;    border-right: solid 3px #999;}.divmiddle p,h3,btnLogin,btnCancel{    float :right ;}</span>
Copy after login

通过代码可以看出,圆角矩形框通过3类的div标签进行组合设计,最终形成一个圆角矩形框。这里关键的是overflow属性,是把被覆盖的内容给隐藏了,所以可以露出自己需要的部分,这里的技巧需要读者自己思考。

接下来就是实战了,在middle中添加如下代码:

<span style="font-family:KaiTi_GB2312;font-size:24px;"><h3 id="牛腩新闻发布系统后台登录">牛腩新闻发布系统后台登录</h3>                    <img src="/static/imghw/default1.png" data-src="Images/步枪.jpg" class="lazy" alt="logo"    style="max-width:90%"  style="max-width:90%">                    <p>用户名:<textbox id="txtUserName" runat="server"></textbox></p>                    <p>密  码:<textbox id="txtPassword" runat="server" textmode="Password"></textbox></p>                    <p>验证码:123456<textbox id="txtCode" runat="server" cssclass="txtcode" width="104px"></textbox></p>                    <p><button id="btnLogin" runat="server" text="登录"></button><button id="btnCancel" runat="server" text="取消"></button></p>                    <div><div class="footer">版权声明:©<a href="http://niunun.javaeve.com">牛腩</a>  &<a href="http://www.tg029.com" target="blank">众志网</a>
</div></div></span>
Copy after login

按照正常的理解,在圆角矩形框中会出现一系列的控件,事实上也是如此,但是却出现了另外一个问题,如下图:


圆角矩形框的边出现了空白,这是由于在使用了

,在这个正常流中

这个部分的宽度比较大,把左右两边的正常流的边给撑开了,所以出现了断线的部分。那么只要把

的部分从正常流中拿走就可以改正这个缺点,对,就是float属性,下面的效果是经过我半个下午2个小时的不断调试,最终形成的结果:

    通过float属性,浮动控件,然后再重新进行定位,这样的效果看似简单,后面包含的过程却是对自己知识的一个总结提升,这个过程对我来说非常享受,全身心的投入到最后的效果出来,感觉那真是爽。当然了这个设计效果还是有提升空间的,比如把整个的框移到垂直方向上的中间线,等等,那就发挥你的想象力吧。



版权声明:本文为博主原创文章,未经博主允许不得转载。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

See all articles