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 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂