无法从Drupal样式表中获取div内联

时间:2015-02-04 19:42:23

标签: html css drupal

在我开始之前,我想说我已经尝试过阅读有关内联div的规则的一些尽职调查。我理解浮动和显示之间的区别(内联,块和内联块)。我已经尝试将包含我希望内联的内容的div具有很大的特异性,但没有结果。要么我错过了我应该定位的类/ id名称,要么我遗漏了样式被继承的地方,这使我无法获得我的结果。我也不确定它是否是Drupal问题,尽管我不相信它是如此。这是一个视图块,如果重要的话我正在使用Nodequeue。任何帮助都将非常感谢!

<div id="block-views-front-listing-block" class="block block-views no-title" > 
    <div class="view view-front-listing view-id-front_listing view-display-id-block customize-front-l view-dom-id-c7e9bbbe5f8b7d663eb76fc6da64aa95">
        <div class="view-content">
            <div class="views-row views-row-1 views-row-odd views-row-first">
                <div class="views-field views-field-field-image">        
                    <div class="field-content">
                        <img typeof="foaf:Image" class="image-style-medium-large" src="http://mysite.dd:8083" />
                    </div>
                </div>  
                <div class="views-field views-field-title">        
                    <span class="field-content"><a href="/content/image-1">Some Location 1</a></span>  
                </div>  
                <div class="views-field views-field-field-price">        
                    <div class="field-content">Cost Per Month</div>  
                </div>  
            </div>
            <div class="views-row views-row-2 views-row-even views-row-last">
                <div class="views-field views-field-field-image">        
                    <div class="field-content">
                        <img typeof="foaf:Image" class="image-style-medium-large" src="http://http://mysite.dd:8083" width="380" height="231" alt="Image-2" />
                    </div>  
                </div>  
                <div class="views-field views-field-title">        
                    <span class="field-content"><a href="/content/image-2">Some other location</a></span>  
                </div>  
                <div class="views-field views-field-field-price">        
                    <div class="field-content">Cost Per Month</div>  
                </div>  
            </div>
        </div>
    </div>
</div>

再次感谢你,我现在绝望了。我花了两天时间,我并不为此感到骄傲。

我的目标是让div容器类“views-row-1”和“views-row-2”内联。

* All styling below is default css for this responsive site at screen pixel     sizes of 1025px and greater */
.container {width:100%;max-width:1140px}
#content-column,.content-column,div.sidebar {float: left; clear: none}
.two-sidebars .content-inner {margin-left: 25%; margin-right: 25%}
.sidebar-first .content-inner {margin-left: 25%; margin-right: 0}
.sidebar-second .content-inner {margin-right: 25%; margin-left: 0}
.region-sidebar-first {width: 25%; margin-left: -100%}
.region-sidebar-second {width: 25%; margin-left: -25%}
.at-panel .region {display:inline;float:left}
.two-brick > .panel-row {float:none}
.two-brick > .panel-row > .region,.two-50 > .region,.three-50-25-25 >   div.region-three-50-25-25-first,.three-25-50-25 > div.region-three-25-50-25- second,.three-25-25-50 > div.region-three-25-25-50-third,.five-5x20 > .row-1  div.region-five-first,.five-5x20 .row-1 div.region-five-second {width:50%}
.two-66-33 > .region-two-66-33-first,.two-33-66 > .region-two-33-66-second,.three-inset-right > .inset-wrapper > div.region-three-inset-right-middle,.three-inset-left > .inset-wrapper > div.region-three-inset-left-middle {width:66.666666%}
.two-66-33 > .region-two-66-33-second,.two-33-66 > .region-two-33-66-first,.three-inset-right > .inset-wrapper > div.region-three-inset-right-inset,.three-inset-left > .inset-wrapper > div.region-three-inset-left-inset,.three-3x33 > .region,.five-5x20 > .panel-row > .region {width:33.333333%}
.three-inset-right > .region-three-inset-right-sidebar,.three-inset-left >   .region-three-inset-left-sidebar,.three-50-25-25 > .region,.three-25-50-25 >   .region,.three-25-25-50 > .region {width:25%}
.three-inset-right > .inset-wrapper {width:75%;float:left}
.three-inset-right > .inset-wrapper > .region,.three-inset-left > .inset-wrapper > .region {width:100%}
.three-inset-left > .region-three-inset-left-sidebar,.three-inset-left >   .inset-wrapper,.three-inset-left > .inset-wrapper > .region-three-inset-left-middle {float:right}
.three-inset-left > .inset-wrapper {width:75%}
.six-6x16 > .panel-row {width:33.333333%;float:left}
.six-6x16 > .panel-row > .region,.five-5x20 > .panel-row {float:none;display:block;width:100%;clear:both}
.four-4x25 > .panel-row > .region,.four-4x25 > .panel-row {width:50%;float:left}

编辑: 在接受了约书亚·惠特利的建议之后,我已经能够将所有内容全部内联,但这并不是我想要的。

#block-views-front-listing-block {
display:inline;
}
.customize-front-l .views-row-1 {
display:inline;
}
.customize-front-l .views-row-2 {
display:inline;
}
.customize-front-l .views-field {
display:inline;
}
.customize-front-l .field-content {
display:inline;
}

如果我改变其中的任何一切,基本上就会回到它全部水平堆叠的方式。我希望位置和价格低于图片,而不必做css体操。任何进一步的提示将非常感激。

1 个答案:

答案 0 :(得分:0)

您的问题可能是由于对块级与内联元素的误解。即使您将.views-row-1和.views-row-2作为目标,并使它们内联并具有足够的特异性(甚至是重要的)来覆盖您站点中的所有其他样式,您还有其他块级元素(更多div) )在默认显示的块中:block,占据容器宽度的100%,导致.views-row-1和.views-row-2展开以包含它们。

首先,您应该将其中一些元素更改为更具语义的元素(p,span等),您可能需要覆盖它们的默认行为。

查看http://www.impressivewebs.com/difference-block-inline-css/以获取有关这两种元素的更多信息和示例。