按钮用css 怎么写

html-css014

按钮用css 怎么写,第1张

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

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

<title>title>

<style type="text/css">

.box {

width: 100pxheight: 100pxposition: relative

}

.box a {

width: 100pxheight: 100pxdisplay: blockposition: absolutetop: 0left:0background: #ffffilter:alpha(opacity=0)/* IE */ opacity:0)/* FF */ 

}

.box a:hover {

width: 100pxheight: 100pxdisplay: blockbackground: url(111.jpg) no-repeat center centerfilter:alpha(opacity=100)opacity:1

}

CSS3代码

随着HTML5/CSS3技术日趋成熟,现如今被越来越多的网站广泛的运用。模板之家代码频道为大家收集整理最新的CSS3按钮代码,CSS3菜单代码,CSS3特效代码等供大家学习交流,好的代码是学习进步的基石同时也可以在项目中得以运用。

首先你的按钮和文本框都是在各自的div里,而不是同层,所以对他们设置float无效,要对他们外面那个div设置float。其次你怎么可以加fieldset div{clear:leftmargin-bottom:2px},这里的clear:left会让所以的div强制换行的。

所以方法很简单,将fieldset div{clear:leftmargin-bottom:2px}改为

fieldset div{float:leftmargin-bottom:2px}即可,即clear改为float即可。

附:input右边有些剪切,因为有padding:1px,所以宽度99%太大,改小点比如95%即可。