给最外层的div命名一个class

有针对性的进行css布局。

<div class="joinus-info">
<div class="form-title">填写表格</div>
<form action="{sh::U('Index/joinus')}" class="smart-green" onsubmit="return checkform();" method="post" id="myform">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="addTable">
<tr>
<td height="48" align="right"><strong>姓名:</strong></td>
<td colspan="3" class="lt"><input type="text" name="name" id="name" class="" size="45" value=""/></td>
</tr>
<tr>
<td height="48" align="right"><strong>手机:</strong></td>
<td colspan="3" class="lt"><input type="text" name="phone" id="phone" class="" size="45" onkeyup="value=value.replace(/[^\d]/g,'')" value=""/></td>
</tr>
<tr>
<td height="48" align="right"><strong>行业:</strong></td>
<td colspan="3" class="lt">
<select name="business" id="business">
<option value="">-请选择-</option>
<option value="LS">零售</option>
<option value="CY">餐饮</option>
<option value="QT">其他</option>
</select>
</td>
</tr>
<tr>
<td height="48" align="right"><strong>地址:</strong></td>
<td colspan="3" class="lt">
<div id='s_city'>
<select name="province" class="prov set_disabled"></select>
<select name="city" class="city " disabled="disabled"></select>
<select name="district" class="dist " disabled="disabled"></select>
</div>
</td>
</tr>
<tr>
<td height="48" align="right"><strong>详细地址:</strong></td>
<td colspan="3" class="lt">
<input type="text" name="address" id="address" class="address" value=""/>
</td>
</tr> <tr>
<td height="48" align="right"><strong>选择代理商:</strong></td>
<td colspan="3" class="lt" style="width: 80%;">
<volist name="agentData" id="vo" mod="3" key="k" empty="暂时没有数据">
<div style="display:inline-block;width:280px;margin:3px;">
<input type="radio" class="regular-radio" value="{sh:$vo.agent_id}" name="agent_id" id="agent_{sh:$k}" <eq name="k" value="1">checked="checked"</eq>><label for="agent_{sh:$k}"></label><span style="display:inline-block;padding:0px 0px 5px 5px;">{sh:$vo.name} 电话({sh:$vo.tel})</span>
</div>
<eq name="mod" value="2"><br/></eq>
</volist>
</td>
</tr>
<tr>
<td height="48" align="right"><strong>备注:</strong></td>
<td colspan="3" class="lt"><textarea name="remarks" class="" placeholder="请输入备注信息..." style="width:300px;height:80px;"></textarea></td>
</tr>
<tr>
<td></td>
<td class="lt">
<notempty name="agentData"><input type="submit" name="submit" value="提交" class="button btn-success"/></notempty >
</td>
</tr>
</table>
</form>
</div>

这里的joinus-info 就是最外层的class

css布局如下

.joinus-info{margin: 0 auto;width:100%;text-align: left;font-size: 16px;background-color:#EFEFEF;}
.joinus-info table{
margin-left:10%;
}
.joinus-info .form-title{
font-size: 20px;
text-align: center;
padding: 10px;
font-weight: bold;
color:#FB780F;
}

div joinus-info中有一个form smart-green

可以针对form进行布局

.smart-green input[type="text"], .smart-green input[type="email"], .smart-green textarea, .smart-green select {
color: #555;
height: 40px;
line-height:15px;
width: 40%;
padding: 0px 0px 0px 10px;
margin-top: 2px;
border: 1px solid #E5E5E5;
background: #FBFBFB;
outline:;
-webkit-box-shadow: inset 1px 1px 2px rgba(238, 238, 238, 0.2);
box-shadow: inset 1px 1px 2px rgba(238, 238, 238, 0.2);
font: normal 14px/14px Arial, Helvetica, sans-serif;
}
.smart-green input[type="text"].address{width: 60%;} /*这里面存在一个执行顺序的问题class先执行,class下面的input后执行*/
.smart-green textarea{
height:100px;
padding-top: 10px;
} .smart-green select{
width: 15%;
} .smart-green input[type="radio"]{
margin-top: 10px;
} .smart-green .button {
background-color: #9DC45F;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-border-radius: 5px;
border: none;
padding: 10px 25px 10px 25px;
color: #FFF;
text-shadow: 1px 1px 1px #949494;
}
.smart-green .button:hover {
background-color:#80A24A;
}

这样布局,不会对其他的模块造成影响。而且目标明确。有意思。

这样form下的表单元素就会加入smart-green的样式了。

css+div布局案例的更多相关文章

  1. CSS+DIV布局中absolute和relative区别

    原文:http://developer.51cto.com/art/201009/225201.htm 这里向大家简单介绍一下CSS+DIV布局中absolute和relative属性的用法和区别,定 ...

  2. CSS+DIV布局初练—DIV元素必须成对出现?

    一直做C/S开发的工作,但是很少做和布局相关的工作,往往都是同事将界面设计好,自己填写代码而已,对于B/S的工作,做过,但是很少没有像C/S这么多,界面布局的话,更无从谈起. 日子就这么过,一天一个样 ...

  3. 网站实战 从效果图开始CSS+DIV 布局华为网站

    经过我们的前面css的学习,我们已经分模块的掌握的CSS的技术,但是,要是完整的做一个页面,我们还没有接触过,这次呢,小强老师来和大家完整的利用CSS+DIV做一个网站案例,我们来模仿下华为的网站. ...

  4. CSS:CSS+DIV布局网页

    现代网页布局:CSS+DIV: 一般的网页都是顺序布局的,很难达到我们需要的网页布局格式,此时使用DIV进行分层布局,类似于盒子,对每一部分内容进行设计.这是现在主流的网页布局方式,使用DIV+CSS ...

  5. 关于css+div布局的疑问 2017-03-19

    第一次布局一个静态网页,发现许多细节都需要自己探索,出现诸如以下问题: 1.布局问题:经常出现一个div被挤出来?做到一半少一个div布局? 布局之前,要点打好框架,明确每个地方的高宽是多少,争取精确 ...

  6. 回答: 2017-03-19的关于css+div布局的疑问 2017-04-05

    原问题为红色,回答为黑色 第一次布局一个静态网页,发现许多细节都需要自己探索,出现诸如以下问题: 1.布局问题:经常出现一个div被挤出来?做到一半少一个div布局? 布局之前,要点打好框架,明确每个 ...

  7. CSS+DIV布局应用(2015年06月10日)

    Div+css布局应用 一.html元素分类 2.1.顶级元素(Top-level element) 定义 组成html页面最顶级标签 特点 1. 不可设置宽高: 2. 必须在文档流中处于最高级位置: ...

  8. 十天学会DIV+CSS(DIV布局)

    一列布局: 一列固定宽度.一列固定宽度居中.一列自适应宽度.一列自适应宽度居中 一列固定宽度 <head> <style type="text/css"> ...

  9. css+div 布局遇到的小常识

    /根目录../上层目录举例如下: 在photo.css文件中写入: div.ls{ background:url(../photo/framels.jpg) no-repeat left; }div. ...

随机推荐

  1. ThinkPadT440 Ubuntu14.04 RTL8192EE 链接无线网

    ThinkPadT440安装完 Ubuntu14.04之后,查看了以下内核版本为: 3.13.0-24-generic 1:通过ifconfig发现没有wlan0 2:通过 lspci -vnn | ...

  2. HDOJ-1012 u Calculate e(水)

    http://acm.hdu.edu.cn/showproblem.php?pid=1012 简单套公式 # include <stdio.h> double Factorial(doub ...

  3. tangible T4 Editor 2.2.3 plus modeling tools for VS 2012 扩展名

    tangible T4 Editor 2.2.3 plus modeling tools for VS 2012 扩展名 tangible T4 Editor 2.2.3 plus modeling ...

  4. java编译相关问题总结

    参考:http://jingyan.baidu.com/article/5bbb5a1b080f6113eba179f0.html 1.在linux下生成的class文件/jar包,拿到windows ...

  5. man/ls/clock/date/echo笔记

    login:    用户名:用户ID    认证机制:Authentication授权:Authorization审计:Audition (日志) prompt,命令提示符:命令:magic numb ...

  6. HDU 4614 Vases and Flowers (2013多校第二场线段树)

    题意摘自:http://blog.csdn.net/kdqzzxxcc/article/details/9474169 ORZZ 题意:给你N个花瓶,编号是0 到 N - 1 ,初始状态花瓶是空的,每 ...

  7. LED音乐频谱之输出数据处理

    转载请注明出处:http://blog.csdn.net/ruoyunliufeng/article/details/38023539 一.PWM调节 1.初始化 void DACInit() { C ...

  8. MVC4中 jquery validate 不用submit方式验证表单或单个元素

    正确引入MVC4 jquery验证的相关文件 <script src="/Scripts/jquery-1.4.4.js"></script> <sc ...

  9. [Redux] Generating Containers with connect() from React Redux (FooterLink)

    Code to be refactored: class FilterLink extends Component { componentDidMount() { const { store } = ...

  10. PPTP协议握手流程分析

    一  PPTP概述 PPTP(Point to Point Tunneling Protocol),即点对点隧道协议.该协议是在PPP协议的基础上开发的一种新的增强型安全协议,支持多协议虚拟专用网,可 ...