CSS Fixed top menu not working on mobile - css

I have a site that is a one page scroll type. I have a fixed menu at the top and this works fine on desktop browsers. It does not work on mobile however, and the menu just stays at the top and when you scroll down it disappears.
My CSS for the header is:
#header {
background: url('../_images/menu_bg.png');
padding-top: 10px;
position: fixed;
top: 0;
left: 0;
z-index: 9000;
width: 100%;
height: 80px;
}

line: 1092 of your styleMobile.css you have this css snippet:
#header {
positioN: relative;
}
Removing that fixes the issue.

Related

Footer won't stay at bottom in Firefox

So I keep my footer at the bottom of my page with the following code:
It's a vue project so #app is my container with my content and footer in.
#app {
min-height: 100%;
position: relative;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 5rem;
}
This works great in Chrome but somehow Firefox doesn't really care and just let's my footer float below my content.
Am I missing anything here?
I think you should be changing position to position: fixed.

Styling bootstrap modal in Angular 5

I am currently trying to style a bootstrap 4 Modal window within Angular 5.
I have the scss imported into my global.scss and I am giving the modal window the customClass as followed.
this.modalService.open(content, { windowClass: 'tutorial'});
So far so good the popup shows up, in the bottom left corner. But what I want to achieve is a bottom modal like in this case.
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_modal_bottom
but whatever I do I cannot seem to get it working.
I just don't seem to be able to stretch the modal all the way. This is my current scss
.tutorial {
position: fixed;
top: auto;
bottom: 0px;
width: 100%;
.modal-dialog{
margin: 0;
}
}
I assumed width: 100% would be fine but somehow it doesn't work.
Any ideas?
So doing the following worked for me
.tutorial-bottom {
position: fixed;
top: auto;
bottom: 0px;
.modal-dialog{
min-width: 100%;
margin: 0;
}
.modal-header {
background: #3e8acc;
color: white;
}
}
Thx to #DahvalJardosh for pointing me in the right direction

window doesn't resize when scrollbar automatically added in IE11

i have an angular project and my view works fine in chrome and firefox but in IE 11 when the scrollbar appears the view doesn't resize automatically so i have some component covered by scroll bar
the menu css:
#menu-principal .navbar-lower {
text-align: center;
position: fixed;
top: 40px;
margin-bottom: 0;
height: 35px;
min-height: 35px;
right: 0;
left: 0;
z-index: 1029;
}
solved by adding
#-ms-viewport{ width: auto; }

CSS property width: 100%; make a page longer

I have a totally simple layout, in the page is only a silver background and the red DIV, as is possible to see on the image below. My problem is, that when I add the red DIV into my layout page, the page is longer on the length than 100% (bottom on the right corner - slider). Where could be a problem that caused this?
The CSS properties of the red DIV are:
html, body {
background-color: silver;
margin: 0;
padding: 0;
}
.red-div {
overflow: hidden;
width: 100%;
position: absolute;
top: 0;
left: 0;
}
.red-div {
overflow: hidden;
position: absolute;
top: 0;
left: 0;
right:0; /* This is what you need */
}
That way, you can force it to go to the end of the browser. When you do 100%, you do not account for the scrollbars. Which add the extra space and thus the annoying side-scroll

z-index and Internet Explorer 9

I've got 2 elements, 2 images of exactly the same dimensions, positioned one on top of the other. Say they're called A and B (A is the top one). What I've done is made it so when you hover over A, its z-index decrements by 2 so that B is now on top, and B's hover: increments its z-index by 2 so it's now higher by 1 than A's original z-index (thus image B stays on top until you remove mouse). So basically...
#A {z-index: 5;}
#B {z-index: 4;}
#A:hover {z-index: 3;}
#B:hover {z-index: 6;}
This works perfectly in Firefox and Chrome, but IE doesn't want to hear about it, and my images keep spazzing while hovering over them. Any help is appreciated. Positioning is Absolute, if that matters.
#jklm313
That actually works in my IE9 as well. Maybe I should post the full code since one of my "images" is actually a social network button. So here it is:
HTML:
<div id="myTweetBrown"></div>
<div id="myTweet"><?php include ("myPHP/homepageSoc/tweet.php") ?></div>
CSS:
#myTweetBrown {
position: absolute;
background-image: url('../images/tweetBrown.png');
background-repeat: no-repeat;
background-position: center center;
height: 20px;
width: 54px;
left: 381px;
top: 662px;
z-index: 5;
}
#myTweetBrown:hover {
position: absolute;
z-index: 3;
}
#myTweet {
position: absolute;
height: 20px;
width: 54px;
left: 381px;
top: 662px;
z-index: 4;
}
#myTweet:hover {
position: absolute;
z-index: 6;
}
tweet.php:
Tweet
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
Link to demo website: ***** -- scroll down to Tweet button
This will be up only for so long, because I don't want people to have access like that <.<
Just going to rewrite my whole answer now the source code has been provided.
All "modern" versions of IE, when not in quirks mode, accept this code perfectly fine for divs and links. The problem in IE arises for iframes and other unusual elements, at which point its rendering engine seems to fail. (Shock!) You'll get this flickering for no apparent reason, except perhaps the conflicting doctypes in the iframe and page, which I would also try avoid if possible.
Presuming this link is generated by twitter, I would advise a fallback approach for IE. Instead of hovering between your button image and a twitter provided button image, I would just manipulate the css of the button twitter provided inside the iframe using javascript.
document.getElementsByTagName('iframe')[0].getElementsByTagName('a')[0].className += 'myTweetBrown';
The button looks to be generated by HTML5 rather than being a static image, so it shouldn't be difficult to manipulate:
.myTweetBrown:hover {
background-image: url('../images/tweetBrown.png') !important;
background-repeat: no-repeat !important;
background-position: center center !important;
height: 20px !important;
width: 55px !important;
}
.myTweetBrown:hover * {
display: none;
}
The other approach you could take is keep doing what you were doing before, but applying the styles differently like so, dependant on display:
#myTweetBrown {
position: absolute;
background-image: url('../images/tweetBrown.png');
background-repeat: no-repeat;
background-position: center center;
height: 20px;
width: 54px;
left: 381px;
top: 662px;
z-index: 5;
}
#myTweetBrown:hover {
opacity: 0;
}
#myTweet {
position: absolute;
height: 20px;
width: 54px;
left: 381px;
top: 662px;
z-index: 3;
}
Technically, CSS doesn't actually specify how and when elements go in and out of the "hover" state. So it sounds like when A goes under B, your version of IE removes the hover state from A and it immediately pops back in front of B, before B gets the hover state and pops further in front.
How about wrapping the two in a div, and testing for the hover state on that? Does that work?
http://jsfiddle.net/X64au/
Try wrap them in a div
.parent
{
position:relative;
z-index:1000;
}
.a
{
position: absolute;
z-index : 1001;
display: inline-block;
}
.b
{
position: absolute;
z-index: 1002;
display: inline-block;
}

Resources