您现在的位置是:首页 > cms教程 > WordPress教程WordPress教程
wordpress模版twentyeleven布局创新
紫安2025-02-19WordPress教程已有人查阅
导读这里就看三个div了,div#main包含了div#primary和div#secondary。为了更清楚,分别给div#primary和div#secondary加上了#069和yellow的背景颜色。
首先上它index.php的一段代码(主要是看它的布局了,这是从浏览器端拷贝出来的,不是最原始的代码了)。
这里就看三个div了,div#main包含了div#primary和div#secondary。为了更清楚,分别给div#primary和div#secondary加上了#069和yellow的背景颜色。
下面的重点就是div#primary和div#secondary。
1、各层的居中:由最外层的div#page实现,html代码中未贴出来
宽度为100%由父元素决定,此处为1000px
通过float浮动和margin结合与div#secondary的float浮动和margin实现了巧妙的定位功能
(background是为了区分层加上的)
宽度为18.8%由父元素决定,此处为188px
通过float浮动和margin结合与div#primary的float浮动和margin实现了巧妙的定位功能
1、感觉比较巧妙的地方
首先,通过div#primary和div#secondary的float:left和float:right是两个层浮动
然后,div#primary中margin-right:-264px,这样就给div#secondary留下了264px的空间,div#secondary的宽度188px加上margin-right的76px正好为264px。
2、这样的好处
尝试着将div#primary的margin-right向负的更多,将div#secondary的margin-right更大的趋势调整,这样即使div#secondary的位置达到了div#primary中内容的位置,也只是重叠不会影响其内容,可以巧妙实现定位作用。
这里就看三个div了,div#main包含了div#primary和div#secondary。为了更清楚,分别给div#primary和div#secondary加上了#069和yellow的背景颜色。
下面的重点就是div#primary和div#secondary。
<div id="main">
<div id="primary" class=" webdeveloper-floated-element">
<div role="main" id="content">
<article class="post-5 post type-post status-publish format-gallery hentry category-1" id="post-5">
<header class="entry-header">
<hgroup>
<h2 class="entry-title"><a rel="bookmark" title="Permalink to 1" href="http://****/blog/changchengdecao/2012/03/30/1/">1</a></h2>
<h3 class="entry-format">Gallery</h3>
</hgroup>
<div class="entry-meta"> <span class="sep">Posted on </span><a rel="bookmark" title="上午 4:21" href="http://****/blog/changchengdecao/2012/03/30/1/">
<time pubdate="" datetime="2012-03-30T04:21:11+00:00" class="entry-date">2012 年 3 月 30 日</time>
</a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a rel="author" title="View all posts by 长城的草" href="http://****/blog/changchengdecao/author/长城的草/" class="url fn n">长城的草</a></span></span> </div>
<!-- .entry-meta -->
</header>
<!-- .entry-header -->
<div class="entry-content">
<figure class="gallery-thumb webdeveloper-floated-element"> <a href="http://****/blog/changchengdecao/2012/03/30/1/"><img width="150" height="150" title="1.index" alt="1.index" class="attachment-thumbnail" src="http://****/blog/changchengdecao/files/2012/03/1.index_-150x150.png"></a> </figure>
<!-- .gallery-thumb -->
<p><em>This gallery contains <a rel="bookmark" title="Permalink to 1" href="http://****/blog/changchengdecao/2012/03/30/1/">3 photos</a>.</em></p>
</div>
<!-- .entry-content -->
<footer class="entry-meta"> <span class="cat-links"> <span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> <a rel="category tag" title="查看 工作 中的全部文章" href="http://****/blog/changchengdecao/category/%e5%b7%a5%e4%bd%9c/">工作</a> </span> <span class="sep"> | </span> <span class="comments-link"><a title="《1》上的评论" href="http://****/blog/changchengdecao/2012/03/30/1/#respond"><span class="leave-reply">Leave a Reply</span></a></span> <span class="edit-link"><a title="编辑文章" href="http://****/blog/changchengdecao/wp-admin/post.php?post=5&action=edit" class="post-edit-link webdeveloper-floated-element">Edit</a></span> </footer>
<!-- #entry-meta -->
</article>
<!-- #post-5 -->
<article class="post-1 post type-post status-publish format-standard hentry category-1" id="post-1">
<header class="entry-header">
<h1 class="entry-title"><a rel="bookmark" title="Permalink to 世界,你好!" href="http://****/blog/changchengdecao/2012/02/29/hello-world/">世界,你好!</a></h1>
<div class="entry-meta"> <span class="sep">Posted on </span><a rel="bookmark" title="上午 1:01" href="http://****/blog/changchengdecao/2012/02/29/hello-world/">
<time pubdate="" datetime="2012-02-29T01:01:27+00:00" class="entry-date">2012 年 2 月 29 日</time>
</a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a rel="author" title="View all posts by snceditor3" href="http://****/blog/changchengdecao/author/snceditor3/" class="url fn n">snceditor3</a></span></span> </div>
<!-- .entry-meta -->
<div class="comments-link"> <a title="《世界,你好!》上的评论" href="http://****/blog/changchengdecao/2012/02/29/hello-world/#comments">3</a> </div>
</header>
<!-- .entry-header -->
<div class="entry-content">
<p>Welcome to <a href="http://****/blog/">花样博客</a>. This is your first post. Edit or delete it, then start blogging!</p>
</div>
<!-- .entry-content -->
<footer class="entry-meta"> <span class="cat-links"> <span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> <a rel="category tag" title="查看 工作 中的全部文章" href="http://****/blog/changchengdecao/category/%e5%b7%a5%e4%bd%9c/">工作</a> </span> <span class="sep"> | </span> <span class="comments-link"><a title="《世界,你好!》上的评论" href="http://****/blog/changchengdecao/2012/02/29/hello-world/#comments"><b>3</b> Replies</a></span> <span class="edit-link"><a title="编辑文章" href="http://****/blog/changchengdecao/wp-admin/post.php?post=1&action=edit" class="post-edit-link webdeveloper-floated-element">Edit</a></span> </footer>
<!-- #entry-meta -->
</article>
<!-- #post-1 -->
</div>
<!-- #content -->
</div>
<!-- #primary -->
<div role="complementary" class="widget-area webdeveloper-floated-element" id="secondary">
<aside class="widget" id="archives">
<h3 class="widget-title">Archives</h3>
<ul>
<li><a title="2012 年三月" href="http://****/blog/changchengdecao/2012/03/">2012 年三月</a></li>
<li><a title="2012 年二月" href="http://****/blog/changchengdecao/2012/02/">2012 年二月</a></li>
</ul>
</aside>
<aside class="widget" id="meta">
<h3 class="widget-title">Meta</h3>
<ul>
<li><a href="http://****/blog/changchengdecao/wp-admin/">管理站点</a></li>
<li><a href="http://****/blog/changchengdecao/wp-login.php?action=logout&_wpnonce=2e55983f13">登出</a></li>
</ul>
</aside>
</div>
<!-- #secondary .widget-area -->
</div>
布局的实现1、各层的居中:由最外层的div#page实现,html代码中未贴出来
#page {
margin: 2em auto;
max-width: 1000px;
}
2、div#primary:宽度为100%由父元素决定,此处为1000px
通过float浮动和margin结合与div#secondary的float浮动和margin实现了巧妙的定位功能
(background是为了区分层加上的)
#primary {
background: none repeat scroll 0 0 #006699;
float: left;
margin: 0 -26.4% 0 0;
width: 100%;
}
3、div#secondary宽度为18.8%由父元素决定,此处为188px
通过float浮动和margin结合与div#primary的float浮动和margin实现了巧妙的定位功能
#secondary {
background: none repeat scroll 0 0 yellow;
float: right;
margin-right: 7.6%;
width: 18.8%;
}
总结:1、感觉比较巧妙的地方
首先,通过div#primary和div#secondary的float:left和float:right是两个层浮动
然后,div#primary中margin-right:-264px,这样就给div#secondary留下了264px的空间,div#secondary的宽度188px加上margin-right的76px正好为264px。
2、这样的好处
尝试着将div#primary的margin-right向负的更多,将div#secondary的margin-right更大的趋势调整,这样即使div#secondary的位置达到了div#primary中内容的位置,也只是重叠不会影响其内容,可以巧妙实现定位作用。
本文标签:
很赞哦! ()
图文教程
WordPress主题插件汉化的方法
使用WordPress的朋友都知道WordPress的主题很多,去网上搜搜就能搜到一大把。有时候找到一个好主题,但是发现居然是英文主题,有点让人失望。
wordpress可以做什么网站,wordpress可以做哪些网站
wordpress能建的网站:1、博客与个人网站,可以让站点变得更加精致、成熟;2、商业网站或者企业官网,它为用户提供了便捷的工具,可以快速启动网站
WordPress Shortcode使用方法详细介绍
WordPress从2.5版本开始增加了一个类似BBCode标签的Shortcode API,可以使用它在日志的内容中来给日志内容添加各种功能。Shortcode这个接口非常容易使用,并且功能非常强大。
WordPress搭建网站的方法
在开始之前,如果你什么都不懂,我建议你不要冒然购买任何东西,可以咨询一下行业内的人,避免买错东西,浪费时间和金钱。
相关源码
-
(自适应响应式)高端网站建设设计公司互联网营销网站pbootcms模板本模板基于PbootCMS内核开发,为网站建设公司和互联网营销企业量身打造。采用响应式设计,适配各种移动设备,提供统一的后台管理体验查看源码 -
(自适应响应式)HTML5电脑手机电子数码产品配件pbootcms模板下载本模板为电脑配件、手机配件及数码周边产品企业设计,基于PbootCMS内核开发。采用现代化响应式布局,适配各类移动设备,能够专业展示各类电子产品配件参数、应用场景和技术特点。模板内置多种产品展示模块,满足不同类型配件企业的展示需求。查看源码 -
(自适应)变压器电子元器件电器配件pbootcms网站模板源码为电子元器件企业打造的响应式网站模板,基于PbootCMS内核开发,助力企业快速构建专业级线上展示平台。支持页面独立设置标题、关键词和描述,内置SEO友好结构。PHP程序确保运行安全稳定,有助于提升搜索引擎收录效果。查看源码 -
帝国CMS7.5手游资讯下载综合门户免费网站模板本模板基于帝国CMS7.5内核开发,为手游打造的综合门户网站解决方案。模板设计充分考虑了手业的特性,包含游戏资讯发布、手游下载、礼包发放、开测信息等核心功能模块,满足手游门户网站的各项业务需求。查看源码 -
(自适应)WordPress二次元博客主题SakurairoSakurairo主题为二次元内容创作者设计,提供丰富的动漫风格元素和个性化的展示效果。该主题在原有Sakura主题基础上进行了功能增强,支持多种自定义设置,满足动漫爱好者建立个人博客的需求。查看源码 -
自适应电子科技类产品公司pbootcms网站模板基于PbootCMS内核开发,为电子科技类企业设计,适用于电子产品展示、企业官网等场景。该模板采用开源架构,用户可自由访问和修改源码,灵活适配各类行业需求,无需二次开发成本查看源码
| 分享笔记 (共有 篇笔记) |

