html - 我如何将此 <ul> 对齐到右边?

标签 html css wordpress

我目前正在尝试对齐 <ul> -在我的博客上标记到右边,但我有很多问题。我试图在 css 中将其 float ,但没有用。我显然不是高级编码员,正如您在 wordpress 中看到的那样,所以我几乎可以肯定我做错了什么。 <ul> -我试图向右对齐的标签是“GPS 状态:”以及 gps 状态的 gif。这是我正在做的页面:blog.dronebutikken.dk

老实说,如果没有 li,我会更喜欢它-tags,避免之间的间距。非常感谢您!

HTML:

<div class="trending-articles">
    <ul>
       <li class="firstlink"><?php _e('Mest populære','mythemeshop'); ?>:</li>
        <?php $i = 1; $my_query = new wp_query( 'cat='.$mts_options['mts_trending_articles_cat'].'&posts_per_page=4&ignore_sticky_posts=1' ); ?>
        <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
            <li class="trendingPost <?php if($i % 4 == 0){echo 'last';} ?>">
                <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php mts_short_title('...', 24); ?></a>
            </li>                   
        <?php $i++; endwhile; endif;?>
    </ul>
    <ul class="gps">
        <li>GPS Status</li>
        <li>
            <a href="http://blog.dronebutikken.dk/k-indeks/"><img src="http://altigator.com/wp-content/uploads/gps/gps_kpstatus.gif" align="right" width="100px"></a>
        </li>
    </ul>
</div>

CSS

热门文章和我无效的 gps 类(class)试图将其正确对齐

.trending-articles {
  background: #2A2A2A;
  border-bottom: 1px solid #000;
  float: left;
  width: 100%;
  position: relative;
  z-index: 100;
}
.trending-articles ul {
  list-style: none
}
.trending-articles li {
  border-right: 1px solid #7D7D7D;
  color: #fff;
  float: left;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2em;
  margin: 10px 0 9px;
  padding: 0 13px;
  text-transform: uppercase;
}
.trending-articles li.firstlink {
  border: none;
  padding-left: 20px;
}
.trending-articles li.last {
  border: none
}
.trending-articles li a {
  color: #7D7D7D;
  display: block;
}
.trending-articles li a:hover {
   color: #fff
}
.gps ul {
  float="right"
}

最佳答案

您正在尝试将样式应用于 <ul>在 gps 类中,但您的类适用于 <ul> . :)

哦,还有 CSS 语法错误。

去:

ul.gps { float: right; }

请注意,选择器中的 ul 可能会被删除。

关于html - 我如何将此 <ul> 对齐到右边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32713123/

相关文章:

javascript - 在段落标题中添加单引号和空格

jquery onmouseover 效果不起作用

php - 为 WooCommerce 产品订单返回和编译 MYSQL 数据

javascript - 使用 javascript 从 WordPress 页面读取 HTML

php - Codeigniter 使用 WordPress 数据库(博客除外)

javascript - HTML5 Canvas 初学者,使用图层吗?

javascript - 仅针对每个元素添加事件监听器

html - 如何创建横跨屏幕 75% 的水平条,但随着屏幕大小的调整而拉伸(stretch)?

javascript - IE 不应用 &lt;style&gt; 内容的奇怪案例

html - 当元素从 display none 中显示时,Div 不会自动调整高度