Mobile menu button jumping around - css

I am building a website for my church,
https://new.churchindenver.org/
and I have a mobile "Menu" button that opens the mobile menu, and a "Close" button that closes it.
Both have the following CSS:
display: inline;
position: absolute;
top:10px;
right: 10px;
I want the menu button to be in absolute position
top:10px;
right: 10px;
When the screen width is 601-895px it works fine. When the screen width is <=600px, the css is being ignored and the "Menu" button jumps down about 50px. (and the logo jumps down too, incidentally, though not as far) Does anyone have any idea why?
Thanks!
Whether ! important or not, and no matter what I put there, the menu button (and the logo) are in absolute position, but apparently not to their parent element.
UPDATE:
Based on Elraphty's suggestion, I made the following hack, which seems to fix it. I'm still not sure what's going on, but at least it looks right. I put:
#media (max-width: 600px) {
#menu {
top: -41px ! important;
}
#logo {
top: -10px ! important;
}
}
and now the menu button and logo are in their proper position at top 10px.

The error is caused by
top:10px;
right: 10px;
Since they both have absolute positions, the solution write a media query than changes the top and right values when the screen is lesser than 600px e.g
#media screen and (max-width: 600px) {
. class {
top: 5px ! important;
right: 5px ! important;
}
}

You can also do this
.nav {
position: relative
}
.navItems {
display: inline;
position: absolute;
top:10px;
right: 10px;
}
So the items are positioned absolute in the nav element not the body element
Or use flex
.nav {
height: 100px;
display: flex;
flex-direction: row;
justify-content: center;
}

Related

Elements overlapping on responsive design

The design I'm working on (apart from the desktop version) has been thinking for a 480px x 720px resolution, but it suppose to show ok on smaller devices. I'm having a lot of problems with the elements on it, they are all overlapping.
This is how it should look like
And this is how it looks on a smaller resolution
My main concern right now is with the overlapping elements, I know I may need to adjust some other things using media queries, but I don't want to continue until I fix this:
correctly position the menu (as it moves and finally disappear).
Show the full masked image.
Prevent buttons (images) from overlapping.
Prevent text from leaving div.
As I believe that I have a very confusing mix/absence of position and display elements on my css.
Relevant code:
#media only screen and (max-width: 500px) {
/*for the menu*/
.site-header {
display: block !important;
}
.sidebar-toggle { //the menu bar-icon properly
right: 390px !important; // I needed to do this because it was originally on the right side (im working on the Magnus theme in wordpress)
display: table;
position: absolute;
float:left;
}
/*for showing the masked image*/
.content-area { //the div that contains the "A" masking the image
overflow: hidden; //without this scroll appears
}
h1.masking-a {
display: block;
position: relative;
}
/*for the text and image buttons*/
.square-footer { //the container div
position: fixed;
}
.square-footer-text {
position: fixed;
}
.square-footer-text p {
position: relative;
text-align: center !important;
}
.square-footer img {
position: fixed;
}
}

Strange alignment of the menu from responsive to normal

sorry for the title...but I have an issue with the alignment of the main menu when the website come from responsive to pc view. (for example it happen when you rotate your tablet from portrait to landscape, or simply you enlarge your browser window from 600pixel wide to 1300px... ).
To understand what I mean just do this (just look at the main menu):
open my website: http://www.piedicosta.com/joomla3/en
reduce browser windows at 500/600 pixel wide, to let the css transform the website in responsive.
open a submenu by clicking on the down arrow at right. Leave the sub menu open.
now enlarge the browser window to let the css transform the website in pc view.
Can you see that the main menu, now float at left?
If you refresh the page, than the main menu comes at center.
This issue happen only if you leave (from responsive view) a submenu item open. If you don't touch the menu in responsive view nothing happen and everything seems working fine.
Is there a simple reason of this issue?
Thank you for your help!
Your problem lies in your responsive.css?reload file.
On line 25:
#tm:checked + .main-menu {
/*display: inline-block;*/
display: block;<-- this guy is the problem-->
}
Change it to:
#tm:checked + .main-menu {
display: inline-block;
}
You can fix for your next problem via CSS media queries. Now to be honest I am not sure which file you should edit, i think it should be responsive.css?reload. Note: Add CSS media code after
#media (min-width: 1024px) {
ul.main-menu li a {
padding: 27px 10px 10px;
}
}
#media (min-width: 1300px) {
ul.main-menu li a {
padding: 13px 17px 10px;
}
}
/*Add code below HERE!!*/
Copy all the code below to your file:
/*
* - Mobile
*----------------------------------------------------------------------------
*/
#media only screen and (max-width: 800px) {/* Serve big tablet layout and tablet menu kindle's and hi-res devices ( portrait ) */
#tm:checked + .main-menu {
display: inline-block;
min-width: 100%;
}
#toggle-menu .drop-icon, #menu li label.drop-icon {
left: 0;
position: absolute;
top: 0;
}
}
#media only screen and (max-width: 768px) {/* Tablets layout*/
#tm:checked + .main-menu {
display: inline-block;
min-width: 100%;
}
#toggle-menu .drop-icon, #menu li label.drop-icon {
left: 0;
position: absolute;
top: 0;
}
}
#media only screen and (max-width: 400px) {/* Small mobile devices */
#tm:checked + .main-menu {
display: inline-block;
min-width: 100%;
}
#toggle-menu .drop-icon, #menu li label.drop-icon {
left: 0;
position: absolute;
top: 0;
}
}
P.S. I think that your current menu configuration can't support what are you asking (didnt't figure out how to make your text align to left without messing something up, but maybe I am wrong) i did however make your arrow dropdown shifted to the right.

height of the Navbar increase after re sizing to mobile size and resetting back again to desktop size

Hi guys i have a very weird problem. If you can see my navbar when resized to mobile size and click in drop down and again make it normal desktop size there is an increase in the navbar height. I wanted a horizontal justified menu for this i used
.menu_container>ul:after{
content: "";
padding-left: 100%;
visibility: hidden;
/* do not use float:left but the display:inline-block below!!! */
display: inline-block;
}
If I removed the content:"", it works fine but the justification of the menu goes off
This is my fiddle
Also attached screenshot for your reference
DEMO
Its because of height: auto; present in
#hidden_menu_collapser:checked + ul {
height: auto;
min-height: 40px;
max-height: 2999px;
background-color:
#FFF;
}
You need update the height:auto; to height: 44px !important; and update it in desktop media query, so that that extra space is removed.
#media only screen and (min-width: 768px) {
#hidden_menu_collapser:checked + ul {
min-height: 40px;
max-height: 2999px;
background-color: #FFF;
height: 44px !important;
}
}
You can just copy paste the above css to your file and it will work

Mobile Site Logo Alignment

I am looking to target my Jobspark logo while viewed on a mobile device. Currently it scrolls down the page and I would like to disable that and place it at top of the page and to the right hand side of the "Menu". This way I could delete the + symbol and it would fit nicely. Below is some code I tried to use to accomplish this. www.jobspark.ca
#media only screen and (max-width: 640px) {
#header #logo h1.site-title {
text-align: left !important;
float: right;
position: absolute;
top: 0;
right: 0;
}
}
Thanks for the help.
******************Update***********************
- Logo hides behind the top navigation while in mobile
- Would like navigation color to be black while in mobile
- Menu text then needs to be white
Here is an mock up of what I would like to accomplish
try this in site.css
#header #logo h1.site-title
{
text-align: left !important;
top: 0;
right: 0;
}
Change max-width to 38% for .primary-nav .nav in site.css
max-width: 38%;
Hope this solves your problem.

Media Queries to keep menu and sidebar from merging with header/body

This is the website, and more specifically, the page.
I'm currently working on a responsive theme, which has media queries, but something about the CSS modifications I've made, are preventing the menu (top right in gold), and the sidebar (this only exists on the blog page, but it is important... it's the box at the right of the content block) from merging with the header/title/left-hand content. It shows up on the ipad mini, the regular ipad 4, but it is okay in an android browser screen. You can observe the issue by resizing the browser.
#media only screen and (min-width:768px) {
.site-navigation .nav-menu {
display: block;
}
}#media only screen and (max-width:767px) {
.menu-toggle {
display: block;
}
}#media only screen and (min-width:768px) and (max-width:959px) {
.wrap {
max-width: 728px;
}
That is the media screen css. The respective divs are all positioned relatively. Does anyone have any advice on how to fix this problem? Any code tidbits?
The first thing I see is that this HTML is not closed:
<div id="header" onclick="location.href='http://camillagabrieli.com
That needs to be fixed first. Try adding outlines to your CSS:
* { outline: 1px dashed black }
I find that helps a lot when it comes to seeing what's actually wrong with the different floated elements. There are quite a few things wrong with your arrangement and your CSS. You don't need to relatively position all of these things.
To fix the main content section:
Add the following to #main:
overflow:hidden;
And make #content and #sidebar-primary like this:
#content {
float: left;
width: 75%;
margin-left: 40px;
margin-right: 10px;
margin-top: 10px;
min-height: 50px;
}
#sidebar-primary {
float: left;
width: 20%;
border-top: 1px solid #222;
border-bottom: 1px solid #222;
height: 50%;
}
I'm not sure why you had margin-top: -460px; in your code, but that was what was breaking it, as was the fact that #main wasn't actually containing #content and #sidebar-primary. The code still needs cleaning up, but this will fix it more immediately.
Does this help?

Resources