css 里表单样式

html-css015

css 里表单样式,第1张

1、按钮的margin-left:-10px这样的负值。或者学度娘,取消input边框另作。

2、css里面font-size:16pxfont-family:"Times New Roman",Georgia,Serif这样。

3、可以设置input的type为image,然后加背景图片。

给出一个例子

<!DOCTYPE HTML>

<html lang="en">

<head>

    <meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" />

    <meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8">

    <title>test</title>

    <link rel="stylesheet" href="css.css" type="text/css" media="screen">

    <script src="http://libs.baidu.com/jquery/1.7.0/jquery.min.js"></script>

</head>

<body>

    <div class="search">

        <input id="search" type="text" autofocus="autofocus" >

        <div class="submit">搜索</div>

    </div>

    <style type="text/css">

        .search{width:300pxoverflow: hiddenborder:1px solid #dddfont-size:16pxheight:2emline-height: 2em}

        .search:hover{border:1px solid #00af60}

        .search input#search{padding-left: 10pxoutline: nonewidth:230pxborder:0}

        .search .submit{cursor:pointerfloat: rightpadding:0 10pxcolor: #00af60border-left: 1px solid #ddd}

        .search:hover .submit{background: #00af60color:#FFFborder:0/*background:url(1.jpg)*/}

    </style>

    <script type="text/javascript">

        $(function(){

            $('.search').hover(function(){$('#search')[0].focus()})//

            $('.search .submit').click(function(){

                alert("在此检查然后js提交")

            })

        })

    </script>

</body>

</html>

以控制的比较多

直接在select上加class就可以设置CSS了

例:

<style type="text/css">

.selectYs

</style>

<form action="#">

<select class="selectYs">

<option value="">1111

<option value="">1111

<option value="">1111

<option value="">1111

</select>

</form>

有的属性浏览器不兼容,但大部分还是可以的你自己试试就知道了