我用html和css创建了一个过滤器布局。
我使用引导程序作为基础,但是我已经大量定制了模板。
请在下面的示例中查找
a:hover {
color: #444;
text-decoration: underline;
}
article {
padding-left: 33px;
padding-right: 33px;
}
/* FACETS */
.extra_callout {
font-size: 12px !important;
font-weight: normal;
text-align: center;
display: block;
margin-top: 10px;
}
.facetwp-slider-wrap {
padding-top: 15px;
}
.facetwp-counts {
float: left;
margin-right: 50px;
}
.sort_title,
.facetwp-sort {
float: left;
}
.facetwp-sort {
margin-left: 10px;
}
#facet_selection {
float: left;
width: 216px;
display: block;
padding-right: 25px;
font-size: 12px;
background: #f3f3f4;
padding: 10px;
margin-right: 20px;
border: 1px solid #949599;
}
.facetwp-dropdown {
font-size: 12px !important;
}
.facetwp-template #comparison_chart {
margin-top: 0;
}
.facetwp-template #comparison_chart .tr {
border-bottom: 1px solid darkgray;
}
#facet_selection p {
padding: 0;
margin: 0;
font-weight: bold;
}
.facetwp-facet {
font-size: 14px !important;
margin-bottom: 15px !important;
}
#facet_selection .title {
font-size: 14px !important;
}
.page-template-page-facet article {
padding-top: 0;
box-shadow: none;
}
.page-template-page-facet {
overflow: scroll;
}
.page-template-page-facet .entry-content {
float: left;
width: 960px;
overflow: hidden !important;
}
.facetwp-type-checkboxes,
.facetwp-type-hierarchy {
max-height: 5000px !important;
}
.cross_buttons {
clear: both;
display: block;
position: relative;
}
.page-template-page-facet #sidebar,
.page-template-page-facet .site-content {
width: 1200px;
}
.page-template-page-experts .site-content {
width: 950px;
}
.comments-area {
clear: both;
}
#comparison_chart img {
max-height: 200px;
border: 1px solid #CCC;
display: block;
margin-bottom: 10px;
}
.faceted .model {
padding-top: 10px;
width: 50% !important
}
.faceted .tr {
overflow: auto;
}
.faceted .tr:nth-child(even) {
background: #f3f3f4;
}
.additional_link {
margin: 10px 0;
text-decoration: none;
background-color: #ff7f00;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fa5), to(#ff7f00));
background-image: -webkit-linear-gradient(top, #fa5, #ff7f00);
background-image: -moz-linear-gradient(top, #fa5, #ff7f00);
background-image: -ms-linear-gradient(top, #fa5, #ff7f00);
background-image: -o-linear-gradient(top, #fa5, #ff7f00);
background-image: linear-gradient(top, #fa5, #ff7f00);
border: 1px solid #bb5d00;
color: #fff;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffaa55, endColorstr=#ff7f00);
padding: 8px 0px;
text-transform: uppercase;
width: 100%;
display: block;
text-align: center;
border-radius: 5px;
}
.clearfix:after {
content: " ";
/* Older browser do not support empty content */
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.facetwp-checkbox {
clear: both;
}
.recommended {
font-size: 11px;
float: left;
position: relative;
top: 2px;
left: 10px;
color: green;
}
.facetwp-facet-must_have .recommended {
top: -5px;
left: 20px;
}
.faceted li.con i {
color: red !important;
text-decoration: none !important;
}
.faceted .making li {
list-style-type: none;
}
.faceted .making ul {
margin-left: 0;
padding-left: 0;
text-indent: -6px;
padding-left: 22px;
margin-left: 6px;
}
.faceted .making ul i {
float: left;
position: relative;
top: 4px;
margin-right: 2px;
margin-left: -20px;
margin-right: 20px;
}
.faceted .model .title {
text-align: center;
display: block;
margin-bottom: 10px;
}
.entry-content .model a {
color: #000;
text-decoration: none;
}
.faceted .price {
width: 35% !important;
text-align: center;
font-size: 24px;
position: relative;
}
.faceted .making {
width: 50% !important;
padding-top: 10px;
padding-right: 10px;
font-size: 13.5px;
}
.faceted .pros {
width: 48% !important;
padding-top: 10px;
font-style: normal !important;
font-size: 13.5px;
}
.faceted .pros ul {
padding-left: 0;
}
.faceted .pros ul li {
list-style-type: none;
font-weight: bold;
margin-bottom: 5px;
line-height: 1.4;
}
.faceted .pros ul li span {
font-weight: normal;
}
.faceted .pro_con {
margin-left: 20px;
display: block;
text-indent: -8px;
padding-left: 14px;
}
.faceted .pro_con.pro {
text-indent: -9px;
}
.faceted .container div:last-of-type .comma {
display: none;
}
.faceted .container div {
display: inline;
font-weight: normal;
}
.faceted .fa-check {
color: green;
}
.faceted .fa-times {
color: red;
}
.faceted .tr {
clear: both;
}
.faceted .tr>span {
float: left;
display: block;
}
.faceted .header_chart {
font-weight: bold;
font-size: 14px;
text-transform: uppercase;
color: #ffffff;
}
.facetwp-sort {
margin-bottom: 20px;
}
.faceted .add_tooltip {
top: 145px;
}
.faceted .header_chart .making,
.faceted .header_chart .pros {
text-align: center !important;
}
.faceted .header_chart .tr>span {
background: #949599;
padding: 5px;
margin: 0;
line-height: 26.9471988677979px;
text-align: center;
}
.faceted .header_chart .pros {
font-style: normal;
}
.faceted .header_chart .tr>span:nth-child(even) {
background: #bdbec1;
}
.faceted .tool {
width: 100% !important;
right: 0px;
left: auto;
top: 20px;
display: none;
background: gray;
text-align: left;
text-transform: none;
font-size: 13px;
color: white;
padding: 5px;
line-height: 1.2;
font-family: 'Open Sans', arial, sans-serif;
position: absolute;
z-index: 5000;
display: none;
}
.site {
max-width: none;
}
.page-template-page-facet .site-content {
max-width: 1200px;
}
.facet-container #facet_selection {
width: 20%;
padding: 1%;
margin-right: 2%;
}
.page-template-page-facet .facet-container .entry-content {
float: left;
overflow: hidden !important;
width: 74%;
/*width: 960px;*/
}
.page-template-page-facet .facet-container .entry-content-mobile {
display: none;
}
.facet-container .faceted .tr>span>span:first-child {
display: none;
}
/*! Tablet --------- */
@media screen and (max-width: 1024px) {
/*#top-container{width:100%;margin:0;}
#top-container .container{padding:0 .5%;}*/
.page-template-page-facet .site-content,
.page-template-page-facet .sidebar {
max-width: 100%;
}
.page-template-page-facet .facet-container .entry-content,
.facet-container .entry-content {
width: 74%;
}
.page-template-page-facet .facet-container .entry-content .model .one_half {
width: 100%;
}
}
/*! Tablet Portrait--------- */
@media screen and (max-width: 900px) and (orientation: portrait) {}
/*! Small Tablet --------- */
@media screen and (max-width: 760px) {}
/* 480px iphone landscape */
@media screen and (max-width: 640px) {
.page-template-page-facet .site-content,
.page-template-page-facet .sidebar {
max-width: 100% !important;
}
#masthead {
display: none;
}
.mobile-container {
display: block;
}
.page-template-page-facet .facet-container .entry-content-mobile {
display: block;
}
.page-template-page-facet .facet-container .entry-content-web {
display: none;
}
.facet-container #facet_selection {
width: 100% !important;
padding: 2% 0;
float: none;
margin: 0 auto 15px;
}
.facet-container #facet_selection p,
.facet-container #facet_selection div {
margin-left: 3%;
margin-right: 3%;
}
.page-template-page-facet .facet-container .entry-content,
.facet-container .entry-content {
width: 100%;
float: none;
}
.facet-container .entry-content .header_chart {
display: none;
}
.facet-container .faceted .tr>span {
width: 100% !important;
padding: 0 0 15px;
float: none;
}
.facet-container .faceted .tr>span>span:first-child {
width: 100% !important;
display: inline-block;
background: none repeat scroll 0 0 #949599;
line-height: 26.9472px;
margin: 0 0 15px;
padding: 5px;
text-align: center !important;
color: #fff;
}
.facet-container .faceted .price {
margin-top: 0;
}
.facet-container .faceted .button {
width: 80%;
margin-left: auto;
margin-right: auto;
}
.facet-container .faceted .making ul {
margin-left: 22px;
}
}
/* 320px iphone portrait */
@media screen and (max-width: 459px) {}
.cross_buttons {
clear: both;
display: block;
position: relative;
}
.buy_link,
.additional_link {
position: relative;
}
.buy_link {
margin: 10px 0px 0px;
}
.button {
text-transform: uppercase;
color: #FFF;
text-align: center;
width: 100%;
display: block;
text-decoration: none;
border-radius: 10px;
border-top: medium none;
border-right: medium none;
border-left: medium none;
-moz-border-top-colors: none;
-moz-border-right-colors: none;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
border-image: none;
margin-top: 10px;
border-bottom: medium none !important;
padding: 8px 0px;
}
.button-rezesionen {
background: #222 none repeat scroll 0% 0%;
;
}
.button-buy {
background: #0274BE none repeat scroll 0% 0%;
;
}
.extra_callout {
font-size: 12px !important;
font-weight: normal;
text-align: center;
display: block;
margin-top: 10px;
}
.clearfix::after {
content: " ";
visibility: hidden;
display: block;
height: 0px;
clear: both;
}
.faceted .making ul {
text-indent: -6px;
padding-left: 22px;
margin-left: 6px;
}
.faceted ul {
margin-bottom: 10px;
}
ul {
list-style: outside none disc;
}
ul,
ol {
margin: 0px 0px 1.6em 1.3333em;
}
.faceted .model .title {
text-align: center;
display: block;
margin-bottom: 10px;
}
.model span {
font-size: 15px;
line-height: 120%;
color: #666;
}
.price {
border-bottom: medium none;
padding: 10px 5px;
width: 100% !important;
text-align: center;
display: block;
margin-top: 45px;
}
.faceted .tr:nth-child(2n) {
background: #F3F3F4 none repeat scroll 0% 0%;
}
.faceted .tr {
clear: both;
}
.faceted .tr {
overflow: auto;
}
.facetwp-template #comparison_chart .tr {
border-bottom: 1px solid #A9A9A9;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #A9A9A9;
}
.faceted .tr:nth-child(2n) {
background: #F3F3F4 none repeat scroll 0% 0%;
}
.faceted .tr {
clear: both;
}
.faceted .tr {
overflow: auto;
}
.one_half {
width: 50%;
}
.full_width,
.one_half,
.one_third,
.two_third,
.one_fourth,
.three_fourth,
.one_fifth,
.two_fifth,
.three_fifth,
.four_fifth,
.one_sixth,
.five_sixth {
float: left;
}
.model span {
font-size: 15px;
line-height: 120%;
color: #666;
}
#comparison_chart .row.buy,
.faceted .price {
border-bottom: medium none;
padding: 10px 5px;
width: 100% !important;
text-align: center;
display: block;
margin-top: 15px;
}
#comparison_chart .col .row span {
display: block;
}
.page-template-page-comparison-new .color-block {
clear: both;
float: left;
width: 16px;
height: 16px;
margin-right: 8px;
border: 1px solid #ccc;
margin-top: 2px;
}
.page-template-page-comparison-new .tab_group.one_fourth {
width: 20%;
}
#comparison_chart tbody tr {
display: none;
}
tr.compare_show {
display: table-row !important;
}
#comparison_chart.compared .key.one_fourth {
display: block;
}
.page-template-page-comparison-new .sort {
display: none;
}
.page-template-page-comparison-new .entry-header,
.entry-content {
padding: 0;
}
.page-template-page-comparison-new .hentry,
.page-template-page-comparison-new .page-header,
.page-content {
box-shadow: none;
padding-top: 0;
}
/* style tabs */
#tabs_compare li {
list-style-type: none;
color: #ffffff;
}
#tabs_compare {
font-size: 14px;
font-weight: bold;
clear: both;
}
#tabs_compare input {
margin-right: 5px;
}
#tabs_compare h5 {
font-size: 16px;
text-transform: uppercase;
margin: 0;
}
#tabs_compare a {
text-decoration: none;
border-bottom: none !important;
}
#tabs_compare a:hover {
cursor: pointer;
}
.tab_group {
clear: both;
}
#checkboxes_shown .tab_group {
display: inline-block;
width: 100%;
}
.tab_group.one_fourth {
clear: none;
padding-right: 5px;
}
.tab_group li {
background: #bdbec1;
padding: 5px 10px;
border: 1px solid #666;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom: none;
}
.tab_group.active li {
background: #949599;
}
.checkbox_full {
clear: both;
width: 100%;
}
#checkboxes_shown .tab_group {
display: none;
}
#checkboxes_shown .tab_group.active {
display: inline-block !important;
}
.Vitamix5200 td {
background: #D0E9C6 !important;
}
#checkboxes_shown {
clear: both;
border: 1px solid #666;
padding: 10px;
border-bottom-right-radius: 5px;
}
/* style results table*/
tbody tr:nth-child(odd) td {
background: #f3f3f4;
}
th {
background: #949599;
text-transform: uppercase;
color: white;
vertical-align: top;
}
#comparison_chart {
font-size: 14px;
color: #666;
box-sizing: border-box;
clear: both;
margin-top: 50px;
}
tr th:nth-child(even) {
background: #bdbec1;
}
td,
th,
tbody,
tale,
#comparison_chart {
border: none;
border-width: 0px;
}
th,
td {
padding: 0px;
text-align: center;
}
#comparison_chart tr {
border: 1px solid #ccc;
}
th,
td {
border-bottom: 0px solid #ccc !important;
}
td {
padding: 10px 0;
vertical-align: top;
}
.containers span,
.controls span {
display: block;
}
.faceted ul {
margin-bottom: 10px;
}
#comparison_chart .row.buy a,
.faceted .price a,
.faceted model a {
text-decoration: none;
background-color: #ff7f00;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fa5), to(#ff7f00));
background-image: -webkit-linear-gradient(top, #fa5, #ff7f00);
background-image: -moz-linear-gradient(top, #fa5, #ff7f00);
background-image: -ms-linear-gradient(top, #fa5, #ff7f00);
background-image: -o-linear-gradient(top, #fa5, #ff7f00);
background-image: linear-gradient(top, #fa5, #ff7f00);
border: 1px solid #bb5d00;
color: #fff;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffaa55, endColorstr=#ff7f00);
padding: 3px;
text-transform: uppercase;
width: 100%;
display: block;
}
.color-block {
clear: both;
}
.colors span {
float: left;
}
.row.buy {
text-transform: uppercase;
}
#comparison_chart .labels {
font-weight: bold;
}
#comparison_chart img {
max-height: 200px;
border: 1px solid #ccc;
display: block;
margin-bottom: 10px;
}
#comparison_chart .col .row:nth-child(even) {
background: #fafafa;
}
.model span {
font-size: 15px;
line-height: 120%;
color: #666666;
}
.model {
font-weight: bold;
width: 15%;
padding: 5px;
}
.price {
width: 5%;
font-size: 16px;
margin-bottom: 5px;
}
.price a {
font-size: 14px;
}
.buy {
width: 11% !important;
}
.warranty {
width: 8% !important;
}
.containers {
width: 8% !important;
}
.hp {
width: 5% !important;
}
.making {
width: 28% !important;
}
.watts {
width: 7% !important;
}
.accessories {
width: 12% !important;
text-align: left;
}
.dimensions {
width: 12% !important;
text-align: left;
}
.pros {
width: auto !important;
text-align: left;
font-style: italic;
padding-right: 5px;
}
th {
padding: 5px 4px;
}
th.accessories,
th.dimensions,
th.pros,
th.making {
text-align: center !important;
}
#comparison_chart .col {
margin-bottom: 30px;
clear: both;
}
#comparison_chart #column_labels th {
font-weight: bold;
}
.model {
font-weight: bold;
}
.model img {
max-width: 100%;
margin: 0 auto;
}
#comparison_chart .blender .accessories,
#comparison_chart .blender .dimensions,
#comparison_chart .blender .pros,
#comparison_chart .making {
text-align: left;
}
.col {
border-bottom: 1px solid #ccc;
height: 165px !important;
}
#column_labels .col {
height: auto !important;
}
#Vitamix5200 .col {
background: #fafafa !important;
}
.blender {
padding: 10px 0px;
}
ul {
padding-left: 20px;
}
.button {
text-transform: uppercase;
color: #ffffff;
text-align: center;
width: 100%;
display: block;
text-decoration: none;
border-radius: 10px;
border: none;
margin-top: 10px;
border-bottom: none !important;
padding: 8px 0;
}
.buy {
position: relative;
}
.buy .additional_savings {
clear: both;
display: block;
margin-top: 10px;
}
.buy a {
display: block;
padding: 3px 15px !important;
line-height: 1.4;
}
.buy_link {
margin: 10px 0 0 0;
}
.buy_link,
.additional_link {
position: relative;
}
.tooltip_icon img {
border: none !important;
}
.tooltip_icon {
position: absolute;
top: 3px;
right: 3px;
width: 12px;
}
.buy .tool {
background: gray;
text-align: left;
text-transform: none;
font-size: 13px;
color: white;
padding: 5px;
line-height: 1.2;
font-family: 'Open Sans', arial, sans-serif;
position: absolute;
z-index: 5000;
display: none;
width: 93%;
}
#select_all {
margin-bottom: 20px;
}
.gform_body {
z-index: 5000;
position: relative;
}
.home .gform_footer {
text-align: center;
position: relative;
top: -75px;
margin-bottom: -100px !important;
z-index: 5;
}
.gform_body .one_fourth {
position: relative;
padding-right: 25px;
}
.gform_body .tooltip_icon {
position: absolute;
top: 0;
right: 10px;
width: 15px;
}
.tooltip {
position: absolute;
top: 30px;
right: 0;
width: 100%;
padding: 10px;
margin: 0 auto;
background: lightgray;
z-index: 5000;
display: none;
}
#compare_choice .one_half {
background: lightgray;
padding: 20px;
text-align: center;
margin-bottom: 20px;
width: 49%;
}
#compare_choice .one_half.model {
margin-right: 1% !important;
font-weight: bold;
}
#compare_choice a {
cursor: pointer;
}
/*hide by feature unless someone completed the quiz */
.page-id-22 #gform_wrapper_1 {
display: none;
}
#gform_wrapper_1 {
font-size: 16px;
}
.widget {
margin: 0;
padding: 0;
width: auto;
}
.site-content {
display: block;
float: none;
margin: 0 auto !important;
max-width: 1200px;
width: 100%;
margin-top: 3em !important;
clear: both;
}
.hentry,
.page-header,
.page-content {
margin: 0 auto;
}
.facetwp-template #comparison_chart .tr {
border-bottom: 1px solid #A9A9A9;
}
.faceted .tr:nth-child(2n) {
background: #F3F3F4 none repeat scroll 0% 0%;
}
.faceted .tr {
clear: both;
}
.faceted .tr {
overflow: auto;
}
#comparison_chart {
font-size: 14px;
color: #666;
}
.entry-content,
.entry-summary,
.page-content,
.comment-content {
hyphens: auto;
word-wrap: break-word;
}
.buttonBuy {
text-transform: uppercase;
color: #FFF;
text-align: center;
background: #ffcc00 none repeat scroll 0% 0%;
width: 100%;
display: block;
text-decoration: none;
border-radius: 10px;
border-top: medium none;
border-right: medium none;
border-left: medium none;
-moz-border-top-colors: none;
-moz-border-right-colors: none;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
border-image: none;
margin-top: 10px;
border-bottom: medium none !important;
padding: 8px 0px;
}
#facet_selection {
float: left;
width: 216px;
display: block;
font-size: 12px;
background: #F3F3F4 none repeat scroll 0% 0%;
padding: 10px;
margin-right: 20px;
border: 1px solid #949599;
}
.faceted li.con i {
color: #F00 !important;
text-decoration: none !important;
}
.faceted .fa-times {
color: #F00;
}
.entry-content {
float: left;
width: 100%;
}
#facet_selection {
width: 260px;
padding: 1%;
margin-right: 2%;
}
.entry-content2 {
float: right;
width: 795px;
}
#facet_selection {
width: 260px;
padding: 1%;
margin-right: 2%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="main-side page clearfix full_width">
<article class="post" id="page-1144">
<div class="entry-content2">
<div class="facetwp-template" data-name="beistellbetten">
<div id="comparison_chart" class="faceted">
<div class="header_chart">
<div class="tr">
<span class="model">Modell</span>
<!--<span class="price">Preis</span>-->
<span class="making">Recommended</span>
<!--<span class="pros">Pros/Cons</span>-->
</div>
</div>
<div class="tr"><span class="model"><a target="_blank" href=""><span class="title">Product 1</span>
<span class="one_half"><img width="300" height="300" src="" class="attachment-medium size-medium wp-post-image" alt="" srcset=""
sizes="(max-width: 300px) 100vw, 300px"></span><span class="one_half last_column clearfix"><span class="price">179.90 €</span></span>
</a>
<span class="cross_buttons">
<a target="_blank" href="" ><div class="button button-rezesionen buy_link">Link 1</div></a>
<span class="extra_callout"></span>
</span>
</span>
<span class="making">
<ul>
<li class="cleanup"><b>Attribute 1:</b>
<span class="pro_con"><i class="fa fa-times"></i>DLorem ipsum dolor sum</span> </li>
<li class="cleanup"><b>Attribute 2:</b>
<span class="pro_con"><i class="fa fa-times"></i>Lorem ipsum dolor sum</span> </li>
</ul>
</span>
</div>
<div class="tr"><span class="model"><a target="_blank"
href="#"><span class="title">Product 2</span>
<span class="one_half"><img width="300" height="300" src="" class="attachment-medium size-medium wp-post-image" alt="" srcset=""
sizes="(max-width: 300px) 100vw, 300px"></span><span class="one_half last_column clearfix"><span class="price">154.99 €</span></span>
</a>
<span class="cross_buttons">
<a target="_blank" href="#" ><div class="button button-rezesionen buy_link">Link 1</div></a>
<span class="extra_callout"></span>
</span>
</span>
<span class="making">
<ul>
<li class="cleanup"><b>Attribute 1:</b>
<span class="pro_con"><i class="fa fa-times"></i>DLorem ipsum dolor sum</span> </li>
<li class="cleanup"><b>Attribute 2:</b>
<span class="pro_con"><i class="fa fa-times"></i>Lorem ipsum dolor sum</span> </li>
</ul>
</span>
</div>
</div>
<div class="facetwp-pager"></div>
</div>
</div>
</article>
</div>
我想在移动设备上仅使div表可滚动。
我尝试添加:
<div id="comparison_chart" class="faceted" style=" overflow-y: auto;
overflow-x: hidden;">
因此,滚动条应出现在两个div的底部。但是,它仍然看起来像这样:
有人建议我在做什么错吗?
感谢您的答复!
答案 0 :(得分:0)
使用 @media
规则为移动窗口或更大的窗口指定任何样式更改,此处的 max-width
属性指定的最大宽度为您的移动窗口。使用溢出-y在y轴上滚动
@media screen and (max-width: 480px) {
body{
overflow-y : scroll;
}
}
答案 1 :(得分:-1)
使用媒体查询,指定您希望它可滚动的大小,仅此而已!您可以从此处获得一些使用媒体查询的帮助: https://www.w3schools.com/css/css3_mediaqueries_ex.asp