Does display block and display none not supported in IE8? - html

I have used two images under a table row with id "bannerweb" for web/common and id "bannermobile" for mobile and tab compatibility.
<tr>
<td valign="top">
<img src="http://campaign.vmware.com/imgs/apac/templates/20596_APAC_ASEAN_Bootcamp/images/Architect_Bootcamp_masthead1.jpg" id="bannerweb" width="700" height="189">
<img src="http://images.connect.vmware.com/eloquaimages/clients/VMWare/{b28e5230-1543-4326-8ee8-a780172f2a75}_Architect_Bootcamp_masthead1_mobile.jpg" id="bannermobile" />
</td>
</tr>
and the style applied as such,
<style type="text/css">
For mobile compatibility,
<!--Mobile-->
#media only screen and (min-width: 0px) and (max-width: 361px) {
#bannerweb{
display:none;
visibility:hidden;
}
#bannermobile{
display:block;
width:235px;
}
}
For tablet view,
<!--Tablet-->
#media screen and (min-width: 362px) and (max-width: 561px) {
#bannerweb{
display:block;
width:500px;
height:150px;
}
#bannermobile{
display:none;
visibility:hidden;
}
}
And this style is applied commonly for all web pages.
<!--Common-->
#media screen and (min-width: 562px) and (max-width: 2000px) {
#bannerweb{
display:block;
}
#bannermobile{
display:none;
visibility:hidden;
}
}
</style>.
But in the above code is not reflected in IE 8 alone. display block and none doesny work in IE 8. Any soultions?

Are you using RespondJs?
IE8 doesn't support by default the media queries, that might be your problem

Related

Media min-width display is overwritten by class style

I'm trying to show a <span> when #media (min-width: 600px) and in other cases to hide that <span>
So i've created a class called elimina-text with display set to none then in media query i'm setting that class to display inline but the media query is overwritten and the text is not shown...
So my anchor where i have to hide the text looks like this
#media screen and (min-width: 600px) {
.elimina-text {
display: inline;
}
}
.elimina-text {
display: none;
}
<a _ngcontent-qmm-c108="" href="" apphref="" class="text-muted button-remove" ng-reflect-href=""><i _ngcontent-qmm-c108="" class="material-icons">delete</i><span _ngcontent-qmm-c108="" class="elimina-text">Elimina</span></a>
Change the order of the CSS.
.elimina-text {
display: none;
}
#media screen and (min-width: 600px) {
.elimina-text {
display: inline;
}
}
<a _ngcontent-qmm-c108="" href="" apphref="" class="text-muted button-remove" ng-reflect-href=""><i _ngcontent-qmm-c108="" class="material-icons">delete</i><span _ngcontent-qmm-c108="" class="elimina-text">Elimina</span></a>

Changing :hover to :active for mobile touch devices

I want to use the :hover effect on desktop (which is working pretty fine) and switch to :active for mobile devices.
.dropdown:hover,
.dropdown:active .dropdown-content {
display: block;
right: 20px;
}
<div class="dropdown">
<div class="dropdown-content">
<p id="dropdown-element">Dashboard öffnen</p>
<p id="dropdown-element">Beratung beenden</p>
</div>
</div>
You can differentiate a CSS rule with the #media construct:
<style>
/* for all types */
.dropdown-content {
...
}
/* for desktop (also old ones) */
#media (min-width : 641px)
{
.dropdown:hover {
...
}
}
/* for smartphones */
#media (max-width : 640px)
{
.dropdown:active {
...
}
}
</style>
<div class="dropdown">
<div class="dropdown-content">
<p id="dropdown-element">Dashboard öffnen</p>
<p id="dropdown-element">Beratung beenden</p>
</div>
</div>
Adjust #media max-width and min-width as your needs.

Hiding an image on mobile only using CSS

I would like to have my site remove an image only on mobile which I was able to accomplish using
#media (max-width: 480px) {
.slide-6996 {
display:block !important;
}
.slide-6996 {
display:none !important;
}
}
However, I also would still like to display the text that was on the slide that I am now not showing. I have tried this in CSS, but it obviously didn't work.
#media (max-width: 480px) {
.slide-6996 {
display:block !important;
}
.slide-6996 {
display:none !important;
#slide-content {
display: block !important;
}
}
}
My HTML for this specific instance is
<div id="slide-6996" class="slide slide-6996 cycle-slide-active slide-left light" style="background-image:url(http://18.205.33.160/wp-content/uploads/2019/02/ITData-Home-Page2018-01-edited.jpg);">
<div class="slide-body">
<div class="container">
<div class="slide-caption">
<div class="slide-content">
<h1><strong>COMPREHENSIVE IT SERVICES YOU CAN TRUST</strong></h1>
</div>
<h2 class="slide-title"> Let us help you develop an IT Optimization Strategy and Define your technological priorities </h2>
<a class="slide-link button button-medium" href="http://18.205.33.160/index.php/itone-method/?customize_changeset_uuid=56ed31cf-ab75-46c7-bf6a-d1eb013fed32&customize_messenger_channel=preview-0&customize_autosaved=on" target="_self"> Learn how we can help you succeed </a>
</div>
<div class="slide-image"></div>
</div>
</div>
</div>
It should also be worth noting that I am on WordPress and am open-minded to any suggested plugins that may fix my issue.
You can't override inline CSS using external CSS, but what you can do is edit your HTML a bit. By adding a new class in that div and in the external CSS you can make rules for what and when to apply.
So, in first line add a new class "background-cls"—your first line needs to be like this:
<div id="slide-6996" class="slide slide-6996 cycle-slide-active slide-left light background-cls">
Then in your external CSS add something like this:
#media (max-width: 480px) {
.background-cls {
background-image: none !important;
}
}
.background-cls {
background-image: url(http://18.205.33.160/wp-content/uploads/2019/02/ITData-Home-Page2018-01-edited.jpg);
}
Here's a fiddle: https://jsfiddle.net/2xb34dev/
With your markup this should work:
#media only screen and (max-width: 480px) {
.slide-6996 .slide-image {
display: none !important;
}
}
Hope that solves it.
You can use #media and then hide that class.
#media (max-width: 576px){
.yourclass{
display:none;
}
}
You can choose 767px or 992px for larger size or you can give your #media with between sizee like following example:
#media screen and (max-width: 576px) and (min-width: 767px) {
.yourclass {
display: none;
}
}

CSS - display:none action not working

I have a staff section on a Wordpress site I'm building with hover effects across each staff member image showing their name, job title and bio.
The staff bio's are quite long and the client is reluctant to change them, however, when looking at the effects on tablet/mobile screen sizes the bios don't fit the smaller image.
I've tried changing the font-size but if I reduce it any further the text will be unreadable.
Rather than change the bio size what I want to do in the media queries is block out the bio's and just leave the name & title using display:none; for the bio <p> tags but I can't get it to work.
Is this the best way to do it?
This is the code for one of the images -
html/php
<div class="staff">
<div class="masonry">
<div class="brick">
<?php if( get_field('whoweare_image1') ): ?>
<img src="<?php the_field('whoweare_image1'); ?>" />
<?php endif; ?>
<div class="details">
<span id="info">
<h3><?php the_field('whoweare_name1'); ?></h3>
<p class="bio"><?php the_field('whoweare_text1'); ?></p>
</span>
</div>
</div>
<!-- identical code for other staff member images -->
</div>
</div>
And this is what I've tried for the media queries (for ipad/tablet portrait) -
style.css
#media only screen and (min-width: 750px) and (max-width: 960px) {
.staff .brick .details #info .bio p {
display: none;
}
}
I added the bio class to the <p> tags after I tried this CSS rule below and it blocked out the whole text including name/title -
#media only screen and (min-width: 750px) and (max-width: 960px) {
.staff .brick .details #info p {
display: none;
}
}
Any assistance would be appreciated.
The selector has to be
.staff .brick .details #info p.bio { ... }
("bio" is the class applied to the p tag)
your target wrong
#media only screen and (min-width: 750px) and (max-width: 960px) {
.staff .brick .details #info p.bio {
display: none;
}
}
https://jsfiddle.net/pcto2Lkj/1/
You can do like below css styles.
#media only screen and (min-width: 750px) and (max-width: 960px) {
.staff .details #info .bio {
display: none;
}
}
Having inspected the elements a little closer I discovered that Wordpress have done that strange thing and added a class to the <p> tag - <p class="p2">so I targeted this attribute and it worked -
.staff .brick .details #info p.p2 {
display: none ;
}
I don't fully understand why these attributes are created, however, this has cleared up why the <p> tag wouldn't work.

CSS on Mobile is not working

I have the following CSS. For some reason, it works until the #max-width:767 media query. However, it does not work but does not work on the resolution, immediately below it, that is, #425. After that, it it starts working again on resolutions below it. Any help identifying this issue would be appreciated.
#media only screen and (max-width: 767px) {
header{height:auto;} body{padding-top:90px;}
#div-header-submenu-rtl, #div-header-submenu {top:-5%; left:25%;}
.text-center-767{text-align:center; padding-top:5px;}
.search-div, .search-div-rtl{width:100%; margin-left:3px;} .search-div-rtl{padding-right:10px; margin-right:0px;}
.txt-search{width: 85%;}
.timeline-poster-name{ margin-top:auto;}
.btn-comment-submit{width:20%; font-size:10px;}
.affiliate-card-padd-3, .affiliate-card-padd-2,.affiliate-card-padd-4{ padding:15px;}
.affiliate-card-padd-3-ar, .affiliate-card-padd-2-ar,.affiliate-card-padd-4-ar{ padding:15px;}
.affiliate-frame, .select-affiliate, .affiliate-frame-store{ margin:0 auto;}
.margin-left-50-767 {margin-left:50px;}
.right-content-area {min-height:auto; padding-bottom:30px;}
.left-grey-bar{height:auto;} .left-grey-fixed-bar, .fixed-filters-rtl{position:relative;} .left-grey-fixed-bar-rtl, .fixed-filters{position:relative; left:0; }
.right-content-area, .left-content-area{min-height:auto;}
.top-links-content-tabs, .top-links-content-tabs-highlight {font-size:12px;}
.displayInLinePhone{display:inline-block;}
.posting-area, .posting-area-division{height:auto;}
.comments-container-row {height:auto;}
.lnkSectionHeading, .sectionHeading{font-size:12px;} .sectionHeading{ text-align:left; padding-top:20px;}
.padd-top-40{padding-top:20px;} .padd-top-20{padding-top:10px;} .padd-top-15{padding-top:7px;}
.sm-icon-grey-bar{width:25px; height:25px; margin-top:5px; margin:0 auto;}
/*---------------------- BUSINESS PRODUCT -------------------------------------- */
#div-main-pic {background-color:#000;}
/* ------------------ LOGIN PAGE ----------------------------------------------- */
.login-headline {font-size:16px; font-weight:800;}
.body-login, .body-login-rtl{background-color:#45c458; background-image:url('../images/login-bg-bhive.jpg'); background-size:auto; background-repeat:no-repeat; background-position:top; }
.btn, .input-credentials, .txt-add-product{margin-top:15px;}
.mob-background{background-color:rgba(255,255,255,0.7);}
.footer{margin-top:5vh;}
/* ------------------ EXHIBITIONS ----------------------------------------------- */
.exhibitions-row{height:auto;}
.text-center-767{text-align:center;}
.img-exhibit-sponsor{width:173px; height:100px; margin:0 auto;}
/* ------------------ Market Timeline ----------------------------------------------- */
}
#media only screen and (max-width: 425px)
{
.top-links-content-tabs, .top-links-content-tabs-highlight {font-size:10px;}
.left-grey-fixed-bar{position:relative;} .left-grey-fixed-bar-rtl{position:relative; left:auto;}
.sm-icon-grey-bar{width:25px; height:25px; margin-top:5px; margin:0 auto;}
.font-size-12{font-size:10px;}
.font-size-14, .lnk-product-title{font-size:12px;}
.text-center-425, .text-center-425-nopadd{text-align:center; padding-top:10px;} .text-center-425-nopadd{text-align:center;}
.padding-top-15-425{padding-top:15px;}
.display-none-425 {display:none;}
#div-header-submenu-rtl, #div-header-submenu {top:15%; left:22%;}
/* ----------------------------- MARKET TIMELINE ----------------------------- */
.timeline-posts-text, .timeline-location-text { text-align:center;}
.lnk-like-share-comment {font-size:10px;}
.span-comment-like-share{text-align:center;}
.img-product-timeline-frame{margin-top:40px; margin:0 auto;}
.span-comment, .span-like, .span-share, .span-x{padding-left:2px; padding-right:2px; padding-top:10px; display:block; text-align:center;}
.span-like, .span-share, .span-comment, .span-x{width:100%; }
#share-update{border:1px solid #f1f1f1;
.post-button{padding:0;}
.video-thumbnail-custom{width:171px; height:114px; margin:0 auto;}
.sectionHeading-no-padd-425{padding:0;}
.btn-overlay, .btn-overlay-rtl{ position:absolute; top:55%; left:58%; margin-top:0 !important;}
.btn-overlay-rtl{left:55%;}
/*------------------------------------ PRODUCT PAGE -------------------------------*/
.product-header-1, .product-header-2, .product-header-3 {margin-top:30px;}
.no-wrap{white-space:nowrap;overflow:hidden;} .no-wrap > div{ float:none; display:inline-table;}
/*---------------------------------- EXHIBITIONS -------------------------------- */
.img-exhibit-sponsor{width:173px; height:100px; margin:0 auto;}
}
#media only screen and (max-width: 375px)
{
.btn-overlay, .btn-overlay-rtl{ position:absolute; top:55%; left:58%;}
.btn-overlay-rtl{left:55%;} .video-thumbnail-custom{width:171px; height:114px; margin:0 auto;}
.row-thumbs{ top:56%;}
/* --------------------------- BUSINESS PRODUCT ---------------------------------------*/
.product-header-1 {font-size:14px;}
.webkit-padd-left-40{ padding-left:15px;}
/*---------------------------------- EXHIBITIONS -------------------------------- */
.img-exhibit-sponsor{width:173px; height:100px; margin:0 auto;}
}
#media only screen and (max-width: 325px)
{
.btn-overlay, .btn-overlay-rtl{ position:absolute; top:59%; left:61%;}
.btn-overlay-rtl{left:22.5%;} .video-thumbnail-custom{width:171px; height:114px; margin:0 auto;}
}
Maybe it's because of a missing closing bracket here:
#share-update{border:1px solid #f1f1f1;
As a tip, i recommend you always validate your css: https://jigsaw.w3.org/css-validator/ you can upload your css file or paste your code there. That way, things like a missing brackets or a typo, won't become a headache :)
Let me know if this helped you.