关于css样式布局

父div的位置设置成相对的,即“position: relative;”。
而子div的位置设置成绝对的,并且下边缘设为0,即“position: absolute; bottom: 0;”
-------------------------
简单的一个需求, 映射着常常被忽略的知识啊。
上次面试没写出来,得学习。
 
·思路及要点:
 
父div的位置设置成相对的,即“position: relative;”。
而子div的位置设置成绝对的,并且下边缘设为0,即“position: absolute; bottom: 0;”。
 
 · 代码:
 
<head>
    <title>子div在父div中置底</title>
    <style type="text/css">
        .father { width: 500px; height: 600px; position: relative; background-color: AliceBlue; }
        .child { width: 400px; height: 100px; position: absolute; bottom: 0; background-color: AntiqueWhite; }
    </style>
</head>
<body>
    <div class="father">
        <div class="child">
        </div>
    </div>
</body>
</html>
·理论简介
 
 
------------------------------底部居中----------------------
Div屏幕底部居中
<!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"  xml:lang="zh-CN" lang="zh-CN">
<head>
<style type="text/css">
html,body {
width:100%;
height:100%;
margin:0px;
padding:0px;
overflow:hidden;
}
#Main {
position:absolute;
bottom:0px;
left:0px;
width:100%;
height:100%;
overflow:auto;
z-index:1;
}
#ToolBar {
position:absolute;
bottom:0px;
right:16px;
width:100%;
height:20px;
text-align:center;
background:#ccc;
z-index:2;
overflow:hidden;
}
</style>
</head>
<body>
<div id="ToolBar">固定在页面底部不动</div>
<div id="Main">
<p><strong>09即将流行的经典语录</strong></p>
<div class="clear">&nbsp;</div>
<div class="info clearfix">
<p class="date">&nbsp;</p>
</div>
<div class="blog_content" id="blog_content">TOP1 <br />

-------------垂直居中-------------
.confirm input{
	vertical-align:middle;
}

<div class="confirm">
<input type="checkbox"/>我已阅读并确认签署合同
</div>

Jquery清除style样式

 

有些页面样式不规范,没有写在一个class里,例如:<div id="show" style="width:100px; padding-top:10px; font-size:12px;"></div>

这种情况下清空style可以removeAttr()方法移除style属性来实现

 

$( "#show" ).removeAttr( "style" ); //ie,ff均支持
 
$( "#show" ).attr( "style" , "" );   //ff支持,ie不支持
 
 
 <a id="btn_ap_submit" unable="true" class="btn_submit_gray mr_10px">确认提交</a>
 
$("#btn_ap_submit").attr("unable","false");
$("#btn_ap_submit").click(function(){
var unable = $("#btn_ap_submit").attr("unable");
if(unable=="true")return;
apSubmit();
});
 
$("#confirm_checkbox").click(function(){
if($("#confirm_checkbox").attr("checked")=="checked"){
$id("dsLoanCom").objects[0].getData("#").set("agree",true);
}else{
$id("dsLoanCom").objects[0].getData("#").set("agree",false);
}
});

 

----------------执行a链接点击事件---------------

因为没用用[0] 所以事件不执行

请登陆淘宝贷款页面进行贷款申请!<br/>

<span id="toAliLoanTime">5秒</span>后将自动跳转<a id="toAliLoanLink" href="https://taobao.aliloan.com/tbloan/index.htm" target="_blank">到阿里贷款</a>

alert($("#toAliLoanLink").html());

$("#toAliLoanLink")[0].click();

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值