【发布时间】:2012-01-18 05:20:38
【问题描述】:
我已经开始制作自己的 wordpress 模板,第一步我用 HTML 制作草图。它看起来像这样。
我在想,黑色矩形是“发布图片”,我想要 4 个在一行中。我应该在while循环中用for循环解决(我猜)。 在我看来它应该是这样的(这是二十一个主题的循环)
<?php
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php for(i=0;i<8;i++)?>
{<?php get_template_part( 'content', 'page' ); ?>}
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
</div>
</div>
<?php get_footer(); ?>
但是我有问题,我应该如何解决定位问题。我想这应该是一篇课文。下面我给你我的代码。请帮忙。
我的html代码:
<div class="postbar">
<div class="post1">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post2">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post3">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post4">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
</div>
<div class="postbar">
<div class="post1">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post2">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post3">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post4">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
</div>
我的 CSS 代码:
div.postbar{
position:relative; left:255px;
height:222px;
}
div.post1 {
margin-top:17px;
position:relative;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
div.post2 {
position:absolute; top:-1px; left:260px;
margin-left:1%;
width:222px;
height:222px;
}
div.post3 {
position:relative; top:-222px; left:520px;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
div.post4 {
position:relative; top:-444px; left:780px;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
div.postNext {
position:absolute; left:250px; top:-1px;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
#postOver{
width:222px;
height:222px;
background-image:url(img/arch.jpg);
box-shadow:0px 0px 3px #000000;
-webkit-transition:width 1s;
}
*:hover > #postOver{
width: 0;
}
#postText{
position:relative; top:-222px;
font-size:12px;
width:222px;
height:222px;
box-shadow:0px 0px 3px #000000;
color:black;
text-align:center;
z-index:-1;
}
【问题讨论】:
-
您将要制作一个自定义模板并将其用于显示。 codex.wordpress.org/Pages#Examples_of_Pages_and_Templates
-
看起来您正在使用 CMS .. 没有看到构建内容的实际页面,很难对其进行调整。您在使用 joomla / Wordpress / 等吗?一些模块可能会变得很复杂。
-
@Silvertiger 我正在使用 wordpress
-
更有可能得到答案here
-
@MetalFrog 好的,但是定位新帖子呢?我应该怎么做?最后找到的帖子有一些链接引用吗?