给最外层的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. 二十六、Jcreator使用初步

    摘自http://blog.csdn.net/liujun13579/article/details/7751464 二十六.Jcreator使用初步 Jcreator是一个小巧灵活的Java开发工具 ...

  2. cenos 安装 phpredis 扩展

    1. php -m 可以查看 php 所有的已经安装的扩展

  3. diffuse linux 文件比对工具

    linux下比较好用的可视化文件比对工具

  4. PHP常用内置函数

    $_SERVER['SCRIPT_NAME'] 返回/mantis/test.php 相对路径 __FILE__返回文件的绝对路径 $_SERVER['HTTP_X_FORWARDED_PROTO'] ...

  5. javascript模式——Flyweight

    Flyweight是一种共享数据内存的模式. Flyweight模式是将一些公有属性从个人中剔除,放在共享的对象当中. 下面以一个项目实例,通过不断的改进,以显示Flyweight模式的优点. 现在我 ...

  6. Node.js实践第一天

    实践案例一 表单提交 demo.html <!doctype html> <html> <head> <title>表单提交</title> ...

  7. EasyUI时间格式化

    changeDateFormatNodate: function (cellval) { var date = new Date(parseInt(cellval.replace("/Dat ...

  8. Swift语法基础入门一(适合有C, OC开发人员)

    Swift开发体验 /*: 创建对象 * OC: alloc initWithXXX 方法 * Swift: (xxx:) */ /*: 调用方法 * OC: [UIColor redColor]; ...

  9. InvokeRequired方法和Invoke函数

    c#中禁止跨进程直接访问控件,为了解决这个问题,出现了InvokeRequried属性,当一个控件的InvokeRequried属性值为真时,说明有控件外的线程想要访问它.这时便会调用到Invoke方 ...

  10. C#中WinForm程序退出方法技巧总结

    C#中WinForm程序退出方法技巧总结 一.关闭窗体 在c#中退出WinForm程序包括有很多方法,如:this.Close(); Application.Exit();Application.Ex ...