douwen5741 2017-11-09 19:30
浏览 109
已采纳

如何以水平对齐方式显示垂直列表

https://jmri.org.in/jmri/issue/archive is the site. As you can see that the issues are arranged in vertical list. I want to show them in a horizontal list through html/css.

The code here in the template here is

<div class="issues_archive">
        {iterate from=issues item=issue}

            <ul>{if $issue->getYear() != $lastYear}
                <h2>{$issue->getYear()|escape} Issues</h2>
                {assign var=lastYear value=$issue->getYear()}<hr>
                {/if}
                                   {include file="frontend/objects/issue_summary.tpl"}
                        </ul>
                        <br><br>    
        {/iterate}

        {if $issues->getPageCount() > 0}
            <div class="cmp_pagination">
                {page_info iterator=$issues}
                {page_links anchor="issues" name="issues" iterator=$issues}
            </div>
        {/if}
    {/if}
</div>

.CSS code is

ul.csv2 { display: -webkit-inline-box; text-align: center; width: auto; position: relative; }

  • 写回答

1条回答 默认 最新

  • dongxuan2577 2017-11-09 19:40
    关注

    Edit:

    I've noticed you have structural issues:

    1. remove all the br tags
    2. the h2 tag in issueabc, needs to be outside of csv class
    

    After that add

    display: inline-block; 
    

    to the ul.csv

    Since I haven't worked with PHP in years, my syntax will not be correct, but here it is:

    {iterate from=issues item=issue}
        {if $issue->getYear() != $lastYear}
            <h2>{$issue->getYear()|escape} Issues</h2>
            {assign var=lastYear value=$issue->getYear()}<hr>
        {/if}
        <ul>
           {include file="frontend/objects/issue_summary.tpl"}
        </ul>
    {/iterate}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 asp.textbox后台赋值前端不能显示什么原因
  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误