Remove element when screen size decreases wordpress - responsive-design

I'd like to completely remove my map from this
http://beyondmyborder.com/destinations/
when the screen size decreases.
Div Id :
id="mapdiv"
Thank you!

So to do a specific action with CSS you need media queries. I suggest you google media queries to get an idea what they do and how they work. I also got an example below. Media queries are basically a statement that execute when the screen width matches the queries. For example if the screen is smaller than 1200px or 979px.
Media breakpoints not working on wordpress
#media only screen and (max-width : 1200px) {
}
#media only screen and (max-width : 979px) {
}
#media only screen and (max-width : 767px) {
}
#media only screen and (max-width : 480px) {
}
#media only screen and (max-width : 320px) {
}
In your case you want a custom media query at 560px:
#media only screen and (max-width : 560px) {
#mapdiv {
display: none;
}
}
What this does; when the screen size is below 560px width. it will execute/overwrite the css. What we say is div with the id: mapdiv add the css rule: display none (hide the element).
To get the mediaqueries/viewport working you also need to add this line in your header:
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Related

React-boostrap NavBar FormControl and Buttons how to control left alignment and size in fluid layout

I learn rectjs and use the react-bootstrap NavBar. I use the suggest breakpoints from Media Queries docs and it looks like this:
Here is my Media Queries breakpoints:
// Extra small devices (portrait phones, less than 576px)
#media (max-width: 575.98px) { ... }
// Small devices (landscape phones, 576px and up)
#media (min-width: 576px) and (max-width: 767.98px) { ... }
// Medium devices (tablets, 768px and up)
#media (min-width: 768px) and (max-width: 991.98px) { ... }
// Large devices (desktops, 992px and up)
#media (min-width: 992px) and (max-width: 1199.98px) { ... }
// Extra large devices (large desktops, 1200px and up)
#media (min-width: 1200px) and (max-width: 1920px) {
I made a CodeSandbox
NOTE: set browser window to 100% zoom in the CodeSandbox for this to work!
My problem is when I resize window and get under width 905px. Then I can't fine grain control layout in css so layout starting to wrap:
This is how it should look:
Under 905px toggle button jumps down:
Under 758px it looks even more bad
I try to change the css:
.container-fluid { // THIS IS LOGO IMAGE
.navbar-brand {
max-width: 37%;
}
}
.form-inline { // THIS IS THE SEARCH INPUT
width: 80%;
}
The problem is I think that I can't move the SEARCH INPUT and the buttons to the left as the screen width gets lesser. Changing the form-inline width to lets say 40px cuts it of only on the right side.
Any advice is helpful thanks?
Moving the button to the left on this image would do the trick I guess but how?

React-icons responsive size

How can I make react-icons icons size smaller for mobile? I understand pixel is not a good approach, but how should I do it?
import { FaSearch, FaFacebook, FaInstagram, FaUserCog, FaUserTimes } from "react-icons/fa";
<FaSearch
color="#023373"
size="30px" />
You can use #media query in your case. Add a class to your icon component and write media query for mobile device width.
<FaSearch color="#023373" className="SearchIcon" />
In your CSS, do this
.SearchIcon{
font-size: 40px;
}
#media only screen and (max-width: 400px) {
.SearchIcon {
font-size: 20px;
}
}
I created a working example using Stackblitz
Here's a list of all the #media queries for different device widths.
/* Extra small devices (phones, 600px and down) */
#media only screen and (max-width: 600px) {...}
/* Small devices (portrait tablets and large phones, 600px and up) */
#media only screen and (min-width: 600px) {...}
/* Medium devices (landscape tablets, 768px and up) */
#media only screen and (min-width: 768px) {...}
/* Large devices (laptops/desktops, 992px and up) */
#media only screen and (min-width: 992px) {...}
/* Extra large devices (large laptops and desktops, 1200px and up) */
#media only screen and (min-width: 1200px) {...}
Another approach is to handle icon sizes on their wrappers. You can set the icon size to auto and change their parent size. You can do it on media queries or with any other method.
<IconContext.Provider value={{ size: 'auto' }}>
<App />
</IconContext.Provider>

Angular 2 web app using fluid layout not responding to more than one screen sizes

Here, I am creating a new web application using Angular 2 framework and applying media query for responsiveness. I am new to this design. I had used two screen breakpoints i.e 600 and 960 and trying to test the responsiveness accordingly. But one of my query not getting apply i.e. 600px.
This is my code,
#media screen and (max-width: 600px) {
mat-card{
width:50%;
height:60%;
margin:9% 9% 9% 19%;
font-size:8px;
}
.fullwidth{
width:50%;
height:50%;
font-size:11px;
padding:10px;
}
mat-card-title{
font-size:13px;
font-weight:bold;
}
mat-card-subtitle{
font-size:11px;
}
}
#media screen and (max-width: 960px) {
mat-card{
width:50%;
height:60%;
margin:9% 9% 9% 19%;
font-size:8px;
}
.fullwidth{
width:90%;
height:50%;
font-size:11px;
padding:10px;
}
mat-card-title{
font-size:13px;
font-weight:bold;
}
mat-card-subtitle{
font-size:11px;
}
}
But in actual browser only media query for 960 is getting applied on 'fullwidth' class.
How can I apply media query to 600px size?
Also how many screen sizes needs to be queried for proper responsive design?
see if this helps you: https://codepen.io/panchroma/pen/pLaJZy
Remember that all CSS rules that are applicable will be applied to an element, and CSS rules cascade. With your original CSS, if the viewport was say 500px, your two media queries would be true, so the last one would be the styling that would be applied.
Instead of your original
#media screen and (max-width: 600px) {
...
}
#media screen and (max-width: 960px) {
...
}
Consider something like the following
#media screen and (max-width: 600px) {
...
}
#media screen and (min-width:601px) and (max-width: 960px) {
...
}
With the above CSS, if the viewport is 500px the first media query will apply, if the viewport is 700px the second media query will apply.
Hope this helps!

Right Banner Position not visible in Tablets and Phones

I have added a vertical banner position (div class = "werbe-wrapper") at the RIGHT HAND SIDE of my webpage golfanatics.de. This position is, however, not shown when looking at the website with a tablet (eg. iPad) or a mobile phone.
The website is based in Joomla, the template allows for a responsive layout which I have DISABLED.
Any idea, where I could look at, in order to have the above position being displayed?
Thanks and cheers,
Ralph
In your custom.css is:
/* Handhelds */
#media (max-device-width: 480px) {
.nomobilebanner {
display: none !important;
}
...
}
and
/* iPad Portrait */
#media screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {
.nomobilebanner {
display: none !important;
}
.noipadbanner {
display: none !important;
}
}
This is where your issue is coming from.

Div show/hide media query

What code can I use to make a particular div show only if on a mobile width?
I have a 100% width full div at the top of my screen, would like it to only show when the device is specified as a mobile width.
I'm not sure, what you mean as the 'mobile width'. But in each case, the CSS #media can be used for hiding elements in the screen width basis. See some example:
<div id="my-content"></div>
...and:
#media screen and (min-width: 0px) and (max-width: 400px) {
#my-content { display: block; } /* show it on small screens */
}
#media screen and (min-width: 401px) and (max-width: 1024px) {
#my-content { display: none; } /* hide it elsewhere */
}
Some truly mobile detection is kind of hard programming and rather difficult. Eventually see the: http://detectmobilebrowsers.com/ or other similar sources.
It sounds like you may be wanting to access the viewport of the device. You can do this by inserting this meta tag in your header.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
http://www.w3schools.com/css/css_rwd_viewport.asp
Small devices (landscape phones, 576px and up)
#media (min-width: 576px) {
#my-content{
width:100%;
}
// Medium devices (tablets, 768px and up)
#media (min-width: 768px) {
#my-content{
width:100%;
}
}
// Large devices (desktops, 992px and up)
#media (min-width: 992px) {
display: none;
}
// Extra large devices (large desktops, 1200px and up)
#media (min-width: 1200px) {
// Havent code only get for more informations
}

Resources