jquery - 为什么在添加 Google Map 时两个 DIVS 没有对齐

标签 jquery html css google-maps

我的 HTML 代码:

<div class="section group">
    <div class="col span_2_of_3 vertAlign">
        <div id="ctl00_BodyPlaceHolder_AddressContentBlock">
            <div class="serviceHolder brClear theAdd"><h2 class="pageIntro">1 maple street</h2>New Roc<br />New Roc<br />09099<br />(934) 313-0909
                <div class="hideContent mapUse">1 maple street New Roc New Roc 09099</div>
            </div>
        </div>
    </div>
    <div class="col span_1_of_3 gMapHolder">
    </div>
</div>

JQuery:

<script>
    $(document).ready(function () {
        alert($(".mapUse").text());
        var k = $(".mapUse").text();
        var embed = "<iframe width='425' height='350' frameborder='0' scrolling='no'  marginheight='0' marginwidth='0'   src='https://maps.google.com/maps?&amp;q=" + encodeURIComponent(k) + "&amp;output=embed&iwloc'></iframe>";
        $(".gMapHolder").html(embed);
    });
</script>

CSS:

.gMapHolder iframe
{
    width: 100%;
    height: 100%;
    border: 1px solid blue;
}
.serviceHolder
{
    width: 100%;
    overflow: hidden;
}
.brClear
{
    clear: both;
}
/*  SECTIONS  */
.section {
    clear: both;
    padding: 0px;
    margin: 0px;
    height: auto;
    overflow: hidden;
    width: 100%;
}

/*  COLUMN SETUP  */
.col {
    display: block;
    /*float:left;*/
    display: inline-block;
    margin: 1% 0 1% 0;
}
.col:first-child {
    margin-left: 0;
}


/*  GROUPING  */
.group:before, .group:after {
    content: "";
    display: table;
}
.group:after {
    clear: both;
}
.group {
    zoom: 1; /* For IE 6/7 */
}
.span_2_of_3 {
    width: 66.1%;
}
.span_1_of_3 {
    width: 32.2%;
}

左边的 DIV 延伸到右边 DIV 的高度以下,带有 map :

enter image description here

enter image description here

如何让左边的 DIV 匹配高度或保持与右边的 DIV 相同的位置

最佳答案

fiddle

http://jsfiddle.net/36cxLucr/4/

添加这个

.col:first-child {
margin-left: 0;
vertical-align: top;
}

关于jquery - 为什么在添加 Google Map 时两个 DIVS 没有对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26535073/

相关文章:

javascript - 打开新标签页,同时下载 PDF

javascript - 使用 Javascript 和/或 jQuery 获取包含的 css 文件的内容

javascript - 如何使用参数将函数附加到事件处理程序

html - 将 2 行文本放在一个圆圈中

html - 如何链接到页面的特定部分(在 Safari 中有效)

html - 为什么 bootstrap 将这些按比例缩放的元素垂直堆叠在列中?

javascript - 滚动元素以水平查看

html - TCL HTML 文件查看器

html - 如何以 Angular 过滤垫卡

javascript - 获取输入值并生成多个文本区域并在那里设置值