如何制作一个漂亮的 css 按钮

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何制作一个漂亮的 css 按钮相关的知识,希望对你有一定的参考价值。

启动dreamweaver,点击“站点”---“新建站点”

2
在弹出的窗口中,站点名称为“漂亮按钮”,本地站点文件夹可以根据需要选择。点击“保存”按钮,站点创建成功。

END
二、创建css文件
1
点击“文件”----“新建”,在弹出的窗体中选择“空白页”-----“CSS”,然后点击“创建”按钮。

2
点击“文件”----“保存”,在文件名中输入“style”,然后点击“保存”,样式表文件创建成功。

END
三、创建html页面
1
点击“文件”----“新建”,在弹出的窗体中选择“空白页”-----“HTML”---“无”。

2
在附加CSS文件中,选择style.css样式表文件,点击“确定”。

3
点击“创建”按钮,生成HTML文件。点击“文件”----“保存”按钮,文件名设置为“index”,最后点击保存即可。

END
三、在html页面中添加一个按钮控件
1
在“插入”-----“表单”中,点击“按钮”

2
在弹出的对话框中,什么也不需要修改,直接点击“确定”。

3
在弹出窗口中,选择“是“

4
按钮添加成功,效果如下。

END
四、新建CSS规则
1
在CSS样式表中,选择“新建CSS规则“

2
在弹出的窗口中选择”类(可应用于任何HTML元素)“,选择器名称设置为“btnstyle”,然后点击“确定”。

3
然后,在找到按钮控件,将它的类设置为”btnstyle”

END
五、用CSS规则修改按钮控件的外观
1
.btnstyle
width: 86px;/*按钮控件的宽度*/
text-align: center;/*按钮控件中文本居中显示*/
line-height: 100%;/*用百分比设置行高*/
padding-top: 0.5em;/*文本顶部的内边距*/
padding-right: 2em;/*文本右侧的内边距*/
padding-bottom: 0.55em;/*文本底部的内边距*/
padding-left: 2em;/*文本左侧的内边距*/
font-family: "Arial Black", Gadget, sans-serif;/*字体*/
font-size: 14px;/*字体大小*/
font-style: normal;/*字体样式*/
font-variant: normal;/*小写字母*/
font-weight: normal;/*文本不需要加粗*/
text-decoration: none;/*文本不需要下划线等*/
margin-top: 0px;/*外边框的距离*/
margin-right: 2px;/*外边框的距离*/
margin-bottom: 0px;/*外边框的距离*/
margin-left: 2px;/*外边框的距离*/
vertical-align: text-bottom;/*图像放在文本下面*/
display: inline-block;/*段落内生出内框*/
cursor: pointer;/*鼠标的形状*/
zoom:1;
outline-width:medium;/*整个轮廓的宽度*/
outline-color:inherit;/*轮廓的颜色*/
font-size-adjust:none;
font-stretch:normal;http://v.youku.com/v_show/id_XMTMzMTM0ODIzMg==.html
border-top-left-radius:0.5em;/*圆角边框弧度*/
border-top-right-radius:0.5em;/*圆角边框弧度*/
border-bottom-left-radius:0.5em;/*圆角边框弧度*/
border-bottom-right-radius:0.5em;/*圆角边框弧度*/
box-shadow:0px 1px 2px rgba(0,0,0,0.2);/*给按钮增加阴影*/
color:#fefee9;/*设置文本的颜色*/
border-top-color:#da7c0c;/*边框的颜色*/
border-right-color:#da7c0c;/*边框的颜色*/
border-bottom-color:#da7c0c;/*边框的颜色*/
border-left-color:#da7c0c;/*边框的颜色*/
border-top-width:1px;/*边框的粗细*/
border-right-width:1px;/*边框的粗细*/
border-bottom-width:1px;/*边框的粗细*/
border-left-width:1px;/*边框的粗细*/
border-top-style:solid;/*边框的样式*/
border-right-style:solid;/*边框的样式*/
border-bottom-style:solid;/*边框的样式*/
border-left-style:solid;/*边框的样式*/
background-image:none;/*背景图片*/
background-attachment:scroll;/*背景图片是否移动*/
background-repeat:repeat;/*允许重复*/
background-position-x:0%;/*背景的x轴坐标*/
background-position-y:0%;/*背景的y轴坐标*/
background-size:auto;/*背景图片的尺寸*/
background-origin:padding-box;/*背景图像相对于内边距框来定位*/
background-clip:padding-box;/*背景被裁剪到内边距框*/
background-color:#f78d1d;/*背景颜色*/
更多学习5 1 r g b

2
再写一句mybtn的hover样式。代码如下:
.btnstyle:hover
background-color: #f47c20;
参考技术A 随着CSS3的快速发展,可以学习使用渐变的背景或者使用背景图片,这样会好看些。但是最好还是不要太花哨 参考技术B 用PS制作成P NG 图片就ok了

Flutter 制作漂亮的登录表单

在本教程中,我将向您展示如何在 Flutter 和 Android studio 中制作漂亮的登录表单,
您将学习如何制作背景图像、如何在 Flutter中制作圆形按钮、如何添加一些不透明度以及如何添加图标到您的文本字段。

import 'dart:ffi';

import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
  home: LoginApp(),
));


class LoginApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: <Widget>[
          Container(
            decoration: new BoxDecoration(
              image: new DecorationImage(
                  image: NetworkImage('https://images.unsplash.com/photo-1439853949127-fa647821eba0?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=80'),
              fit: BoxFit.fill
              ),
            ),
          ),
          Opacity(
            opacity: 0.5,
            child: Container(
              decoration: new BoxDecoration(
                gradient: LinearGradient(
                  begin: Alignment.topRight,
                  end: Alignment.bottomLeft,
                  colors: [Colors.blue,Colors.purpleAccent],
                ),
              ),
            ),
          ),
          Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text('Login',style: TextStyle(
                  fontSize: 60.0,
                  letterSpacing: 2.0,
                  color: Colors.white,
                  fontStyle: FontStyle.italic,
                ),
                ),
                Padding(
                  padding: EdgeInsets.symmetric(horizontal: 35.0, vertical: 22.0),
                  child: TextField(
                    decoration: InputDecoration(
                      filled: true,
                      fillColor: Colors.white,
                      border: InputBorder.none,
                      hintText: 'User Email',
                      contentPadding: EdgeInsets.all(16.0),
                      prefixIcon: Icon(Icons.email,color: Colors.blue,)
                    ),
                  keyboardType: TextInputType.emailAddress,
                  ),
                ),
                Padding(
                  padding: EdgeInsets.symmetric(horizontal: 35.0, vertical: 12.0),
                  child: TextField(
                    decoration: InputDecoration(
                      filled: true,
                      fillColor: Colors.white,
                      border: InputBorder.none,
                      hintText: 'User Password',
                      contentPadding: EdgeInsets.all(16.0),
                      prefixIcon: Icon(Icons.lock,color: Colors.blue,)
                    ),
                    obscureText: true,
                  ),
                ),
                Text("Forget your password ?", style: TextStyle(color: Colors.white),),
                SizedBox(
                  height: 40.0,
                ),
                RaisedButton(
                  onPressed: (){},
                  shape: StadiumBorder(),
                  color: Colors.blueAccent,
                  textColor: Colors.white,
                  child: Text("Login",style: TextStyle(fontSize: 22.0),),
                  padding: EdgeInsets.symmetric(vertical: 12.0,horizontal: 80.0),
                  elevation: 0.0,

                )
              ],
            ),
          )
        ],
      ),
    );
  }

}

以上是关于如何制作一个漂亮的 css 按钮的主要内容,如果未能解决你的问题,请参考以下文章

分享10款漂亮的 CSS 按钮源码

如何制作一个漂亮的主菜单页面

多款常用的按钮css源码

CSS3制作漂亮的照片墙

css 一个简单而漂亮的按钮设计。

Flutter 制作漂亮的登录表单