When responsive mode icons not come properly - html

Hi, I have a problem with responsive. When it's responsive mode I need 4 icons in single line. Same like web mode. Please help. I added code in image.
<ul class="nav nav-tabs first">
<li class="active" style="padding-right: 15px;">
<a href="#Mala" data-toggle="tab">
<img style="padding-bottom: 15px;" src="laalsa.com/business/wp-content/uploads/2018/07/Malaicon.png" alt="" width="144" height="144">
<br>Mala Connect</a></li>
<li style="padding-right: 15px;">
<a href="#LaalsaApp" data-toggle="tab">
<img style="padding-bottom: 15px;" src="laalsa.com/business/wp-content/uploads/2018/07/laalsaappicon.png" alt="" width="144" height="144">
<br>Laalsa App</a></li>
</ul>
<li style="padding-right: 15px;">
<a href="#Toran" data-toggle="tab">
<img style="padding-bottom: 15px;" src="laalsa.com/business/wp-content/uploads/2018/07/toranicon.png" alt="" width="144" height="144">
<br>Toran</a></li>
</ul>
<li style="padding-right: 15px;">
<a href="#Web" data-toggle="tab">
<img style="padding-bottom: 15px;" src="laalsa.com/business/wp-content/uploads/2018/07/webicon.png" alt="" width="144" height="144">
<br>Web</a></li>
</ul>

You need to add #media css. Try this
#media screen and (max-width: 767px){
.icons-parent-elements-class{
display:inline-block;
width:25%;
float:left;
}
}

To achieve that you have to change the width of each element to the number of elements divided by 100%. for example:
#media (min-width: 750px){
.icons-parent-elements-class {
width: 25%;
display: inline-block;
float: left;
}
}

HTML:-
<div class="container">
<div class="div1">
<img src="pathnameofimage.png">
</div>
<div class="div2">
<img src="pathnameofimage.png">
</div>
<div class="div3">
<img src="pathnameofimage.png">
</div>
for mobile screens use
CSS:-
#media(max-width: 767px){
.container{
display:flex;
justify-content:center;
flex-direction:column;
}
}

#media(max-width: 767px){
.nav-tabs.first li {
width: 25%;
margin: 0;
float: left;
padding-right: 8px !important;
}
.nav-tabs.first li a img {
width: 100%;
max-width: 80px !important;
height: auto!important;
margin: 0 auto;
display: inline-block;
}
}
please try it. if don't work then please share your code. and also remove the height and width form the image tag. these are creating problem in the responsive view.

Related

responsive gallery with description giving problem

I'm trying to build an image gallery with description below the image. Every thing run well except when i added in a longer description, the second row goes misorder.
How to overcome this issue?
my testing site is : http://osakaairport.com/airlines/index.htm
below is the sample code: (short code due to limited by stack overflow)
<style>
#media only screen and (max-width: 500px) {
.responsive-main {
width: 100%;
}
}
*{
box-sizing: border-box;
}
.responsive1 {
padding: 0 6px;
float: left;
width: 19.99999%;
}
#media only screen and (max-width: 500px) {
.responsive1 {
width: 32%;
}
div.desc1 {
padding-top:3px;
padding-bottom:10px;
text-align: center;
font-size: 12px;
}
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
</style>
<div class="responsive1">
<div class="gallery1">
<a href="china_airlines/index.htm">
<img src="../images/airlines/china_airlines_logo.png" alt="China Airlines"></a>
<div class="desc1">Japan Airlines Japan Airlines</div>
</div>
</div>
<div class="responsive1">
<div class="gallery1">
<a target="_blank" href="../facilities/wifi.htm">
<img src="../images/airlines/airasia_indonesia.png" alt="airasia indonesia"> </a>
<a target="_blank" href="../facilities/wifi.htm">
<div class="desc1">All Nippon Airways</a></div>
</div></div>
<div class="responsive1">
<div class="gallery1">
<a target="_blank" href="../facilities/wifi.htm">
<img src="../images/airlines/cebu_pacific.png" alt="cebu pacific">
</a>
<div class="desc1">Peach</div>
</div>
</div>
<div class="responsive1">
<div class="gallery1">
<a target="_blank" href="../facilities/wifi.htm">
<img src="../images/airlines/china_airlines_logo.png" alt="china airlines">
</a>
<div class="desc1">9 Air</div>
</div>
</div>
<div class="responsive1">
<div class="gallery1">
<a target="_blank" href="../facilities/wifi.htm">
<img src="../images/airlines/china_eastern_airlines.png" alt="China Eastern Airlines">
</a>
<div class="desc1">AirAsiaX</div>
</div>
</div>
<div class="clearfix"></div>
One way to tackle this is to set the following to class responsive1.
<style>
.responsive1{
padding: 0 6px;
width: 19.6%; // adjust your width accordingly base on your demand
display: inline-block; // behave as block elements inside, but inline elements outside, just like the behavior of characters
// no need to use float:left in this case
vertical-align: top;
}
</style>

Responsive Images in Grid

I'm using the Bulma grid framework to customize part of the interface for our Learning Management System. I have a simple vertical nav (1 column on larger screens) on the left and then there is a large promo banner in the middle (8 columns wide on larger screens) with a smaller promo banner to the right (3 columns wide on larger screens). I have it setup so that all three items show on desktop-sized screens, and then at slightly smaller breakpoints I have it so that only the nav and the large promo show, and then on mobile I have it so that only the nav shows.
The issue I'm having is that I can't get the height of the smaller promo banner on the right to match that of the main promo. I've tried adjusting the dimensions of the image placeholder so that it's not square (like it currently is) and no matter what I do it's either slightly shorter or slightly taller than the main promo. I need them to be the same height when both are in view.
Originally I had it setup so that the images stayed a static size and were just "cropped" as they shifted using
object-fit:cover;
but that doesn't work IE11 which unfortunately is a requirement (and is also not ideal since these images will be promo banners and parts would be getting cut off)....so that's why I'm trying to figure this way out to have them resize appropriately.
Here is a JSFiddle so you can see what I mean: http://jsfiddle.net/markb088/zpfbc7y3/5/
Here's the code from the JSFiddle in-case it becomes unavailable:
html{
overflow-y: hidden !important;
}
body{
overflow-x: hidden;
background-color:#f3f3f3;
}
a.navLink{
position:absolute;
width:100%;
height:90%;
top:0px;
right:0px;
text-decoration:none;
z-index:10;
background-color:white;
opacity:0;
filter:alpha(opacity=0);
}
.menuContainer{
background-color: white;
border: 3px solid #d9d9d9;
/*height: 350px;*/
font-size: 0.8em;
font-weight: bold;
line-height:1.2;
}
#media only screen and (max-width:768px){
.columns{
margin-left: 0.5rem;
margin-right: 0.5rem;
}
}
.respImg{
/* height:350px;*/
width:100%;
/*object-fit: cover;*/
}
.imgHolder{
position:relative;
overflow:hidden;
}
.navItem1, .navItem2, .navItem3{
position:relative;
/* height:110px;*/
padding-top:10px;
}
#media only screen and (max-width:631px){
.regQuickNav{
display:none;
}
.menuContainer{
height: 125px;
}
}
#media only screen and (min-width:632px){
.mobileQuickNav{
display:none;
}
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css" rel="stylesheet"/>
<body>
<div class="columns" style="margin-left: 2rem; margin-right: 2rem; margin-top: 6px;">
<div class="column is-1-fullhd is-1-widescreen is-1-desktop is-2-tablet is-12-mobile is-flex-desktop-only is-flex-tablet-only">
<div class="menuContainer">
<div class="mobileQuickNav">
<div class="columns is-mobile " style="margin: 0 0 0 0;">
<div class="column">
<div style="position: relative;"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://i.imgur.com/3COCw5x.png" alt="" width="100" height="70" />
<p style="text-align: center;">My Plan</p>
<a class="navLink" href="#">My Plan</a></div>
</div>
<div class="column">
<div style="position: relative;"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://i.imgur.com/YWTV4pn.png" alt="" width="100" height="70" />
<p style="text-align: center;">Browse Courses</p>
<a class="navLink" href="#">Browse Courses</a></div>
</div>
<div class="column">
<div style="position: relative;"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://i.imgur.com/L07pkyt.png" alt="" width="100" height="70" />
<p style="text-align: center;">Events Calendar</p>
<a class="navLink" href="#">Events Calendar</a></div>
</div>
</div>
</div>
<div class="regQuickNav">
<div class="columns" style="margin: 0 0 0 0;">
<div class="column is-full">
<div class="navItem1"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://i.imgur.com/3COCw5x.png" alt="" width="100" height="70" />
<p style="text-align: center;">My Plan</p>
<a class="navLink" href="#">My Plan</a></div>
<div class="navItem2"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://i.imgur.com/YWTV4pn.png" alt="" width="100" height="70" />
<p style="text-align: center;">Browse Courses</p>
<a class="navLink" href="#">Browse Courses</a></div>
<div class="navItem3"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://i.imgur.com/L07pkyt.png" alt="" width="100" height="70" />
<p style="text-align: center;">Events Calendar</p>
<a class="navLink" href="#">Events Calendar</a></div>
</div>
</div>
</div>
</div>
</div>
<div class="column is-8-fullhd column is-8-widescreen is-11-desktop is-10-tablet is-10-mobile is-hidden-mobile">
<div style="background-color: blue; overflow: hidden; position: relative;"><img class="respImg" src="https://i.imgur.com/GH2QEuJ.png" /></div>
</div>
<div class="column is-3-fullhd column is-3-widescreen is-hidden-tablet-only is-hidden-desktop-only is-hidden-mobile">
<div style="background-color: red; overflow: hidden; position: relative; border: solid 1px #999999;"><img class="respImg" src="https://i.imgur.com/jqbRA3S.png" /></div>
</div>
</div>
</body>
*Note that you'll need to expand the results panel and your browser wide enough so that the smaller promo banner shows. Majority of the CSS is included in the head tags of the html, due to the restrictions of the LMS.
I'm not overly familiar with grid systems, so not sure if I'm missing something to make it show with a matching height but still be responsive.
Thanks!
If you have the option to add the image as a background, you can use the following CSS:
.column {
background-size:cover;
}
It will also work with IE11.
The other option which will distort your image aspect ratio is to set a min-height value to the image:
.respImg {
min-height: 300px;
}

Center text underneath images in a row

The text representing each image is currently located to the right of the image. I want the text to be centered underneath its corresponding image, how do I achieve this?
Please note that I applied display: inline-bock on the list items, so they are in a row.
#footer1 {
float: left;
width: 100%;
border: 10px solid #e3e3e3;
}
#footer1>ul>li {
padding: 0 8px;
display: inline-block;
}
#footer1 a:hover img {
border: 1px solid #5cadff;
text-decoration: none;
box-shadow: 5px 5px 2px 2px #5cadff;
}
#footer1 img {
border: 1px solid transparent;
margin-left: 110px;
}
<div id="footer1">
<h2> SOURCES </h2>
<ul>
<li>
<a href="https://www.wikipedea.com" title="wikipedia">
<img height="50" src="http://www.placehold.it/50" width="50">
</a>
w
</li>
<li>
<a href="https://www.google.com" title="google">
<img height="50" src="http://www.placehold.it/50" width="50">
</a>
Google
</li>
<li>
<a href="https://www.youtube.com" title="youtube">
<img height="50" src="http://www.placehold.it/50" width="50">
</a>
Youtube
</li>
<li>
<a href="https://www.nlm.nih.gov/" title="Nih.gov">
<img height="50" src="http://www.placehold.it/50" width="50">
</a>
Nih
</li>
<li>
<a href="https://www.medindia.net" title="MedIndia.net">
<img height="50" src="http://www.placehold.it/50" width="50">
</a>
MedIndia
</li>
</ul>
</div>
I was able to do this without any changes to your existing HTML by doing this:
li{
display:inline-block;
text-align:center;
width:70px;
}
li img{
margin:0 10px;
}
The text-align centers all text and child elements inside the li. The width needs to be large enough that no caption will be too large to fit in that width. (If a caption won't fit in the allotted width, then the centering is wrecked.)
I added the left and right margin to the image for a little bit of future-proofing in case you later want to include a very short caption in your list. With that margin, even a very short caption will be forced to the next line (instead of next to the image) since 50 px image width + 10 margin on each side leaves no room for text.
Edited for float, keeps these inline and overflows if doesn't fit on page.
<style>
.container {
clear: both;
}
ul li {
width: 50px;
float: left;
text-align: center
}
ul li a {
text-decoration: none;
}
</style>
<div class="container">
<ul>
<li>
<a title="wikipedia" href="https://www.wikipedea.com">
<img src="wikipedia.png" height="50" width="50">wikipedia
</a>
</li>
<li>
<a title="wikipedia" href="https://www.wikipedea.com">
<img src="wikipedia.png" height="50" width="50">wikipedia
</a>
</li>
<li>
<a title="wikipedia" href="https://www.wikipedea.com">
<img src="wikipedia.png" height="50" width="50">wikipedia
</a>
</li>
</ul>
</div>
Please try this
HTML:
<div id="footer1">
<h2> SOURCES </h2>
<div class="item">
<a title="wikipedia" href="https://www.wikipedea.com">
<img src=""/>
</a>
<span class="caption">Text below the image</span>
</div>
<div class="item">
<a title="wikipedia" href="https://www.wikipedea.com">
<img src=""/>
</a>
<span class="caption">Text below the image</span>
</div>
<div class="item">
<a title="wikipedia" href="https://www.wikipedea.com">
<img src=""/>
</a>
<span class="caption">Text below the image</span>
</div>
</div>
CSS:
div.item {
vertical-align: top;
display: inline-block;
text-align: center;
width: 120px;
}
img {
width: 100px;
height: 100px;
background-color: grey;
}
.caption {
display: block;
}
DEMO

Grid not working in Bones theme

I'm using Bones theme from Themble, which includes a grid system in it's style. I have tried to implement it in the header for my menu items so that they will size down into icons in mobile size and show the full menu in desktop screens.
The problem is that I can't get the grid to work, all the menu items float next to each other, on all screen sizes. The divs 'menubar' is only as big as the icon.
The grid is working on other areas, such as the sidebars and content areas. I'm not really familiar with responsive columns so hopefully it's obvious to some of the pros here.
Also, so you know, I'm working locally with koala, a processor for the Sass.
Header
<body <?php body_class(); ?>>
<div id="container">
<header class="header" role="banner">
<div id="inner-header" class="wrap ">
<div id="logo" class="menubar m1of5 t1of5 d2of6 cf">
<img src="/home_icon.png">homepage
</div>
<div id="menu-icon" class="menubar m1of5 t1of5 d1of6 cf">
<img src="/icon.png"/>
</div>
<div id="menu-icon" class="menubar m1of5 t1of5 d1of6 cf">
<img src="/icon.png"/>
</div>
<div id="menu-icon" class="menubar m1of5 t1of5 d1of6 cf">
<img src="/icon.png"/>
</div>
<div id="menu-icon" class="menubar m1of5 t1of5 d1of6 last-col cf">
<img src="/icon.png"/>
</div>
</div>
</header>
Grid
#mixin grid-col {
float: left;
padding-right: 0.75em;
}
// the last column
.last-col {
float: right;
padding-right: 0 !important;
}
#media (max-width: 767px) {
.m-all {
#include grid-col;
width: 100%;
padding-right: 0;
}
.m-1of5 {
#include grid-col;
width: 20%;
}
}
And on and on for other sizes and screens.
Style
This is the mobile styling....
.header {
width:100%;
position: fixed;
background-color: $white;
border-bottom: 2px solid $border-color;
}
.menubar {
float: left;
}
#logo {
font-size: 0px;
a {
text-decoration: none;
}
}
#menu-icon {
background-color: $light;
border-radius: 4px;
}
<div id="logo" class="menubar m1of5 t1of5 d2of6 cf">
<img src="/home_icon.png">homepage
</div>
Your class names should be hyphenated:
<div id="logo" class="menubar m-1of5 t-1of5 d-2of6 cf">
<img src="/home_icon.png">homepage
</div>

horizontal alignment of the lists

how to make the lists to display inline........
now it is in vertical alignment can i make it into horizontal alignment....
providing my fiddle link below....
http://jsfiddle.net/JNyQU/1/
<ul class="homePageLists" style="">
<li style="padding-bottom: 5px; list-style: none; ">
<img alt="squareList" style="margin-right: 10px;" id="logo" src="http://www.defie.co/designerImages/square_list.png">
Menu
</li>
<li style="padding-bottom: 5px; list-style: none; ">
<img alt="squareList" style="margin-right: 10px;" id="logo" src="http://www.defie.co/designerImages/square_list.png">
Search
</li>
<li style="padding-bottom: 5px; list-style: none; ">
<img alt="squareList" style="margin-right: 10px;" id="logo" src="http://www.defie.co/designerImages/square_list.png">
Create PN
</li>
<li style="padding-bottom: 5px; list-style: none; ">
<img alt="squareList" style="margin-right: 10px;" id="logo" src="http://www.defie.co/designerImages/square_list.png">
Product List
</li>
<li style="padding-bottom: 5px; list-style: none; ">
<img alt="squareList" style="margin-right: 10px;" id="logo" src="http://www.defie.co/designerImages/square_list.png">
Create PN
</li>
<li style="padding-bottom: 5px; list-style: none; ">
<img alt="squareList" style="margin-right: 10px;" id="logo" src="http://www.defie.co/designerImages/square_list.png">
Create PN
</li>
</ul>
Use float:left;:
ul { clear: left; } // clear logo img
li { float: left; }
E.g. http://jsfiddle.net/JNyQU/4/
I have included a jFiddle for you.
http://jsfiddle.net/persianturtle/JNyQU/6/
The solution was to add a class to the container of the unordered menu list, which I called "inline."
The CSS was:
.inline ul {
float:left;
display:inline;
}
.inline ul li {
float:left;
display:inline;
}
The only HTML I changed was:
<div class="inline">
Hope this helps you! If it does, please don't forget the check mark!
Also, I added some margin to the left so it looks better! You can change that however you like.