【问题标题】:CSS - Wordpress placing two iframes side by side with textCSS - Wordpress 将两个 iframe 与文本并排放置
【发布时间】:2015-11-16 20:25:15
【问题描述】:

我绝不是网站编码专家,这实际上是我第一次弄乱这样的代码。

我正在为我的俱乐部运行一个 wordpress 网站,我需要执行以下操作:

1.) 将两个谷歌地图 iframe 放在另一个下方(理想情况下,两者之间留有小空间)并放在页面的右侧。

2.) 将几行描述地图/场地的文字从上方排成一行并放在地图的左侧。

这是我的尝试:

<div style="float: left; width: 200px;">Little Venice Sports Centre
10 Crompton Street
W2 1ND
Tel: 020 7641 5111</div>
<div style="float: right; width: 425px;"><iframe style="border: 0;" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d9929.981791888986!2d-0.177116!3d51.522472!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x53e809c8db1dbfb3!2sLittle+Venice+Sports+Centre!5e0!3m2!1sen!2suk!4v1412638341053" width="400" height="300" frameborder="0"></iframe></div>

<div style="float: left; width: 200px;">Ethos Sports Centre
7 Prince's Garden
SW7 1NA
Tel: 020 7594 0910</div>
<div style="float: right; width: 425px;"><iframe style="border: 0;" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2483.713596042022!2d-0.17350875000000218!3d51.500123050000006!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x487605448bddeb47%3A0x9a96da198601f824!2sEthos+Sports+Center%2C+Knightsbridge%2C+London+SW7%2C+UK!5e0!3m2!1sen!2sae!4v1440265942096" width="400" height="300" frameborder="0" allowfullscreen="allowfullscreen"></iframe></div>

【问题讨论】:

    标签: css wordpress iframe


    【解决方案1】:

    您需要将两个 iframe 与信息一起放置在单独的 div 中,然后使用 CSS position 将 iframe 定位到右侧

    http://jsfiddle.net/jofish999/h3eqeq04/

    <div class="map">
        <div style="float: left; width: 200px;">
        Little Venice Sports Centre
        10 Crompton Street
        W2 1ND
        Tel: 020 7641 5111
        </div>
        <iframe style="border: 0;" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d9929.981791888986!2d-0.177116!3d51.522472!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x53e809c8db1dbfb3!2sLittle+Venice+Sports+Centre!5e0!3m2!1sen!2suk!4v1412638341053" width="400" height="300" frameborder="0"></iframe>
    </div>
    <br>
    <div class="map">
        <div style="float: left; width: 200px;">
        Little Venice Sports Centre
        10 Crompton Street
        W2 1ND
        Tel: 020 7641 5111
        </div>
        <iframe style="border: 0;" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d9929.981791888986!2d-0.177116!3d51.522472!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x53e809c8db1dbfb3!2sLittle+Venice+Sports+Centre!5e0!3m2!1sen!2suk!4v1412638341053" width="400" height="300" frameborder="0"></iframe>
    </div>
    

    .map {
        width: 800px;
    }
    iframe {
       position: relative;
        right: -150px;
    }
    

    【讨论】:

    • 嗨,代码的 jsfiddle 预览在文本方面看起来很糟糕?另外,#iframe div 的样式是什么意思?对不起,这里绝对是新手!!!
    • 让我解决这个问题@AriBenCanaan 你想要文本吗?
    • 看我上面贴的图片。
    • 嘿,这在 jsfiddle 中看起来很棒,但是当我将 HTML 代码复制到 wordpress 时,它看起来不像在 jsfiddle 中的那样。 CSS 框中的代码重要吗?在wordpress中我该怎么办?对不起!!!
    • 没问题,您有指向您的 wordpress 网站的链接吗? @AriBenCanaan 是的,CSS 代码很重要,但请稍等,我会为您内联它
    猜你喜欢
    • 2017-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多