html中div定位练习
2015-12-16 19:38
525 查看
html中div定位练习,实现简单的计划列表:
planCtr.js中的代码:
plan.json中的代码:
记录div定位时主要的属性:float、position等,以及对应的relative和absolute等,同时使用到angular js中的数据绑定,$http请求等等,记录备忘:
login.css中代码:
/* 主页面数据列表 */ .planWrite{ background-color: #868383; margin: 9px; font-size: 16px; width: 93%; height:330px; } .plDiv{ width: 32%; position: absolute; margin:0px; border: 1px solid #060606; } .plDiv1{ width: 30%; position: absolute; margin:0px; } #div1_2{ left:1%; top:60px; height: 350px; background-color: #868383; } #div2_2{ left:35%; top:60px; height: 350px; background-color: #868383; } #div3_2{ left:69%; top:60px; height: 350px; background-color: #868383; } #plDiv{ left: 2%; width: 95%; height:420px; margin: 10px; position: relative; } #div1{ height:370px; left:0px; top:50px; background-color: #A4A6A5; } #div1_1{ height:50px; left:0px; background-color: #060606; color:#FAF8F8; font-size: 30px; font-family: 微软雅黑; } #div2{ height:370px; left:34%; top:50px; background-color: #A4A6A5; } #div2_1{ height:50px; left:34%; background-color: #060606; color:#FAF8F8; font-size: 30px; font-family: 微软雅黑; } #div3{ height:370px; left:68%; top:50px; background-color:#A4A6A5 ; } #div3_1{ height:50px; left:68%; background-color: #060606; color:#FAF8F8; font-size: 30px; font-family: 微软雅黑; } /*
<div id="plDiv"> <center> <div class="plDiv" id="div1_1"> 今日计划 </div> </center> <div class="plDiv" id="div1"> </div> <div class="plDiv1" id="div1_2"> <ul> <li ng-repeat="plan in plans">{{plan.msgContent}}</li> </ul> </div> <center> <div class="plDiv" id="div2_1"> 今日总结 </div> </center> <div class="plDiv" id="div2"> </div> <div class="plDiv1" id="div2_2"> <!--summary总结--> <textarea class="planWrite" ng-model="todaySummary"></textarea> </div> <center> <div class="plDiv" id="div3_1"> 明日计划 </div> </center> <div class="plDiv" id="div3"> </div> <div class="plDiv1" id="div3_2"> <textarea class="planWrite" ng-model="tomorrowPlan"></textarea> </div> </div>
planCtr.js中的代码:
angular.module('contactsApp') .controller('planCtr',function($scope,$http){ $scope.todaySummary="有总结才知得失"; $scope.tomorrowPlan="有计划才不慌乱"; $http.get("./json/plan.json").success(function(plans){ console.log(plans); $scope.plans=plans; }); });
plan.json中的代码:
[ { "msgContent":"明天会更好" }, { "msgContent":"每天进步一点点" }, { "msgContent":"总有一个适合你" } ]
效果图:
相关文章推荐
- html中div定位练习
- html 相对定位 绝对 定位 css + div
- html js点击按钮滚动跳转定位到页面指定位置(DIV)的方法代码
- html页面块元素的定位(DIV,Table,UL,LI等)
- HTML[CSS+DIV] 网站布局练习 Zun'Showing
- Html精确定位,ScrollHeight等介绍,以及一个例子实现在某个控件处打开一个DIV
- HTML+Div+Css 入门练习
- 用图片定位html背景
- 通过使用绝对定位和相对定位,实现div底部对齐
- HTML 获取相同 id 但是 不同 div 的元素的值
- HTML表单表格综合练习
- HTML的div作用
- 学习笔记2017.07.11-day8,pm-HTML实例练习
- html2练习
- HTML中的css和div,和table的用法
- jQuery offset,position,offsetParent,scrollLeft,scrollTop html控件定位 css position
- html 中如何让鼠标箭头移到某个区域(div,input,a等标签)上就变为手型,移出后再变为原型。
- HTML第七章上机练习2
- HTML练习2
- week8---10月27日 DIV布局定位(二)