首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >PHP和JSON进入Div

PHP和JSON进入Div
EN

Stack Overflow用户
提问于 2021-06-10 23:30:57
回答 1查看 30关注 0票数 0

因此,我有一个JSON数组,它可以在布局视图中很好地解析,但是来自json的元素是垂直堆叠的,我需要它们水平对齐。以下是示例代码

代码语言:javascript
运行
复制
<div class="swiper-container mySwiper2 swiper-container-h">
    <div class="swiper-wrapper">
        <div class="swiper-slide swiper-padding">
            <?php include_once("team_hq.php"); ?>

        </div>
        <div class="swiper-slide  swiper-padding bkg bkg3">
            <h2>Partners</h2>
            <?php 
            showStuff($stuff, "Partners"); ?>

        </div>
        <div class="swiper-slide swiper-padding bkg bkg12">
            <h2>Production</h2>
            <?php showStuff($stuff, "Production"); ?>
        </div>
        <div class="swiper-slide  swiper-padding bkg bkg13">
            <h2>Sales</h2>
            <?php showStuff($stuff, "Sales"); ?>
        </div>
        <div class="swiper-slide  swiper-padding bkg bkg14">
            <h2>Support</h2>
            <?php showStuff($stuff, "Support"); ?>
            
        </div>
    </div>
    <div class="swiper-button-next"></div>
    <div class="swiper-button-prev"></div>
    <div class="swiper-pagination"></div>
</div>

我要问的问题是,如何才能使从$stuff变量中提取的内容水平呈现,而不是像现在那样垂直呈现。

EN

回答 1

Stack Overflow用户

发布于 2021-06-10 23:35:03

要水平放置HTML元素,可以使用:

FlexboxCSS-GridFloating

但是假设您的函数showStuff只打印一个JSON字符串,那么您必须使用$stuff变量。例如,循环遍历it's content HTML PHP我想- and会根据你的需要来构建- with-Tags。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67924245

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档