位于页面右侧的左对齐文本有问题吗?

发布于 2024-10-10 20:14:04 字数 3354 浏览 3 评论 0原文

我在使用 Wordpress 时遇到问题;我试图将摘录文本框浮动到页面的右侧,同时仍保持其左对齐。我尝试将 PHP 向右对齐,这使位置正确,但也从右侧对齐。我不确定是否将 CSS 与 PHP 的摘录链接起来。

这是上面的 PHP & CSS 下面的

<?php get_header(); ?>

<div id="content">
 <div id="entry_content">
 <?php if (have_posts()) : ?>

 <?php while (have_posts()) : the_post(); ?>

  <?php if(is_home()) { if ( function_exists('wp_list_comments') ) { ?>  <div <?php   post_class(); ?>> <?php }} ?>

 <!--<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"      title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
      <p class="date"><?php the_time('F jS, Y') ?> <?php comments_popup_link('&sect; <span class="commentcount">0 comments</span>', '&sect; <span class="commentcount">1 comment</span>', '&sect; <span class="commentcount">% comments</span>'); ?></p>-->

       <div class="post">

 <?php { if ( function_exists('add_theme_support')) the_post_thumbnail( 'post-thumbnail' ); } ?>      

 <?php the_content('&raquo; Read the rest of this entry &laquo;'); ?>  
    <div class="pagination">
      <?php wp_link_pages(array('before' => '<p><span>Page</span>', 'after' => '</p>',       'next_or_number' => 'number')); ?>
    </div>

 </p><?php the_excerpt(); ?></p></a></div>
  </div>

    <p class="tags"><?php the_tags('<span>Tagged </span> ', ', ', ''); ?></p>

  <?php endwhile; ?>

  <div class="navigation">
    <p class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></p>
        <p class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></p>
  </div>

   <?php else : ?>

  <div class="entry">
   <span class="error"><img src="<?php bloginfo('template_directory'); ?      >/images/mal.png"       alt="error duck" /></span>
    <p>Hmmm, seems like what you were looking for isn't here.  You might want to give      it   another try - the server might have hiccuped - or maybe you even spelled something wrong (though it's more likely <strong>I</strong> did).</p>
   </div>

<?php endif; ?>

</div> <!-- close entry_content -->

<?php get_sidebar(); ?>

CSS:

/* =Layout
------------------------------------------------------------------*/
 #wrapper {
width: 75em;
margin: 0 ;
 }

 #header {
  display: block;
 }

 #main_nav {
width: 0em;
margin: -1.8em 0 0 0;
float: left;
display: inline;
    position: fixed;
    width: 120px;
height: 100%;
    padding: 0em 0em 0em 3em;
background: #f5f5f5
 }

 {TO POSITION THE PAGE TEMPLATE CHANGE WIDTH & MARGIN=HEIGHT}

 #content {
width: 55em;
margin: 1em 0 0 0;
float: right;
display: inline;
min-height: 30em;
 }

  #post_content {
width: 100em;
margin: 10em 2.5em 0 1.5em;
float: left;
display: inline;
  }

  {TO POSITION THE POSTS TEMPLATE CHANGE WIDTH & MARGIN=HEIGHT}

 .post {
    width: 83em;
margin: 1.5em 0 0 0;
float: right;
display: inline;
min-height: 30em;
 }

I'm having trouble on Wordpress; I'm trying to float an excerpt text box to the right hand side of the page whilst still keeping it left aligned. I've tried aligning the PHP to the right which put the position right but also aligns from the right. I'm not sure about linking the CSS with only the excerpts PHP.

This is the PHP above & CSS below

<?php get_header(); ?>

<div id="content">
 <div id="entry_content">
 <?php if (have_posts()) : ?>

 <?php while (have_posts()) : the_post(); ?>

  <?php if(is_home()) { if ( function_exists('wp_list_comments') ) { ?>  <div <?php   post_class(); ?>> <?php }} ?>

 <!--<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"      title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
      <p class="date"><?php the_time('F jS, Y') ?> <?php comments_popup_link('§ <span class="commentcount">0 comments</span>', '§ <span class="commentcount">1 comment</span>', '§ <span class="commentcount">% comments</span>'); ?></p>-->

       <div class="post">

 <?php { if ( function_exists('add_theme_support')) the_post_thumbnail( 'post-thumbnail' ); } ?>      

 <?php the_content('» Read the rest of this entry «'); ?>  
    <div class="pagination">
      <?php wp_link_pages(array('before' => '<p><span>Page</span>', 'after' => '</p>',       'next_or_number' => 'number')); ?>
    </div>

 </p><?php the_excerpt(); ?></p></a></div>
  </div>

    <p class="tags"><?php the_tags('<span>Tagged </span> ', ', ', ''); ?></p>

  <?php endwhile; ?>

  <div class="navigation">
    <p class="alignleft"><?php next_posts_link('« Older Entries') ?></p>
        <p class="alignright"><?php previous_posts_link('Newer Entries »') ?></p>
  </div>

   <?php else : ?>

  <div class="entry">
   <span class="error"><img src="<?php bloginfo('template_directory'); ?      >/images/mal.png"       alt="error duck" /></span>
    <p>Hmmm, seems like what you were looking for isn't here.  You might want to give      it   another try - the server might have hiccuped - or maybe you even spelled something wrong (though it's more likely <strong>I</strong> did).</p>
   </div>

<?php endif; ?>

</div> <!-- close entry_content -->

<?php get_sidebar(); ?>

CSS:

/* =Layout
------------------------------------------------------------------*/
 #wrapper {
width: 75em;
margin: 0 ;
 }

 #header {
  display: block;
 }

 #main_nav {
width: 0em;
margin: -1.8em 0 0 0;
float: left;
display: inline;
    position: fixed;
    width: 120px;
height: 100%;
    padding: 0em 0em 0em 3em;
background: #f5f5f5
 }

 {TO POSITION THE PAGE TEMPLATE CHANGE WIDTH & MARGIN=HEIGHT}

 #content {
width: 55em;
margin: 1em 0 0 0;
float: right;
display: inline;
min-height: 30em;
 }

  #post_content {
width: 100em;
margin: 10em 2.5em 0 1.5em;
float: left;
display: inline;
  }

  {TO POSITION THE POSTS TEMPLATE CHANGE WIDTH & MARGIN=HEIGHT}

 .post {
    width: 83em;
margin: 1.5em 0 0 0;
float: right;
display: inline;
min-height: 30em;
 }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深陷 2024-10-17 20:14:04
 #content {
width: 55em;
margin: 1em 0 0 0;
float: right;
display: inline;
min-height: 30em;
text-align:left;
 }
 #content {
width: 55em;
margin: 1em 0 0 0;
float: right;
display: inline;
min-height: 30em;
text-align:left;
 }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文