Header not displayed correctly in Firefox - html

I just figured out that in my website botlane.net the header is not displayed correctly in Firefox.
Display in Chrome: (Correct behavior) (Also in Internet Explorer)
http://gyazo.com/b76f64331a59eb60e9fc4ade66d76fbb
Display in Firefox: (Wrong behavior)
http://gyazo.com/943e97e3762bf6b85e9d0b5e1c8a2ad0
I managed to recreate the problem in a JSFiddle
http://jsfiddle.net/e8ry9art/1/
HTML:
<div id="header">
<div id="headWrap">
<a href="/rankings">
<div id="navi1">
<span >RANKINGS</span>
</div>
</a>
<a href="/">
<span class="helper"></span><img id="logo" src="http://botlane.net/assets/images/logo3.png" alt="Logo" />
</a>
<a href="/legal">
<div id="navi2">
<span>LEGAL INFORMATION</span>
</div>
</a>
</div>
<div id="fulldash"></div>
</div>
CSS:
div#header {
width: 100%;
height: 10%;
min-height: 100px;
position: relative;
}
div#headWrap {
width: 1224px;
height: 100%;
margin: auto;
text-align: center;
white-space: nowrap;
}
div#navi1 {
float:left;
height: 100%;
width: 200px;
}
div#navi1:hover {
color: #FFAD19;
}
div#navi2 {
float: right;
height: 100%;
width: 200px;
}
div#navi2:hover {
color: #14CC67;
}
Can anyone tell me what is the problem here?

Try replacing with these styles:
div#headWrap {
width: 1224px;
height: 100%;
margin: auto;
text-align: center;
}
div#navi1 {
float:left;
height: 100%;
width: 200px;
margin-top: 24px;
}
div#navi2 {
float:right;
height: 100%;
width: 200px;
margin-top: 24px;
}
The above styles work because of the removal of white-space: nowrap. The nowrap property is intended to keep text from wrapping to the next line, and can conflict with text-align: center since the parent reference for centering is handled differently by firefox.

Try this base on my comments:
div#header {
width: 100%;
height: 10%;
min-height: 100px;
position: relative;
}
div#headWrap {
width: 1224px;
height: 100%;
margin: auto;
text-align: center;
}
div#navi1 {
float:left;
height: 100%;
width: 200px;
white-space: nowrap;
}
div#navi1:hover {
color: #FFAD19;
}
div#navi2 {
float: right;
height: 100%;
width: 200px;
white-space: nowrap;
}
div#navi2:hover {
color: #14CC67;
}
.vmiddle {
position: relative;
top: 50%;
transform: translateY(-50%);
}
<div id="header">
<div id="headWrap">
<div id="navi1">
RANKINGS
</div>
<span class="helper"></span> <a href="/"><img id="logo" src="http://botlane.net/assets/images/logo3.png" alt="Logo" />
</a>
<div id="navi2">
LEGAL INFORMATION
</div>
</div>
<div id="fulldash"></div>
</div>

There are a few things wrong here and I think Chrome and whatever browser is displaying this as intended by you is just a little bit more forgiving.
First, when using the CSS id selector (e.g. div#navi2) you don't need to prepend the tag name of the element you're targeting. #navi2 is specific enough and everything else is just clutter.
Second, why those extra divs inside the a elements? You can spare those and directly work with the link elements. They are just as fine.
Third, you're applying your layout code (float) to elements that are further down the DOM hierarchy than the one layer you're actually targeting. You're trying to sort things out in #headWrap and should therefor work with its direct children. But instead you're skipping the a elements completely and apply your code to the divs. While this isn't wrong per se, in general this means trouble.
Fourth, floated elements (like your links) should come before the element that is being floated. Just a tip to avoid headaches.
I forked your Fiddle with an improved version: http://jsfiddle.net/maryisdead/Lsrhjnby/

Related

Div 2 Column Set up using images and block-links inline-block not working - Shopify/liquid

Thanks for your patience with me hopefully someone can help me get this thing sorted. The OLD JSFiddle has been manipulated so many times I've just left off where I was last. I've started a new one hopefully in a cleaner, better direction. I'm no professional so again I don't know every rule, especially CSS. Thanks.
Important stuff:
OLD JSFIDDLE: https://jsfiddle.net/Craftworksatb/qot0aj9h/18/
NEW JSFIDDLE: https://jsfiddle.net/Craftworksatb/h4L3dyLw/
I'm working with Shopify's Liquid trying to fix up the index page so that it doesn't look like a mess of product collections flying all over the page. So here's where I decided to come up with a whole new mess:
Basically all I want to do (after hours and hours of toying and fiddling and positioning, displaying, google searching.. etc etc. again, not a pro) All I want to do is have two columns which are set up with 2 different sized images, one of those images (Furniture Gallery) has links associated with it as you'll see in the OLD JSFiddle. The second Column has 3 different sized images in the second column, those are basic links. You'll see this sort of layout in the OLD Jsfiddle. I keep thinking I'm getting somewhere, but.. as you can see I'm a bit stuck. I started the newest JSfiddle to kind of narrow down what I was doing wrong..
Newest code below:
HTML:
<div id="mid-page" class="container padded-row">
<div id="furni-card" class="mcard">
<img src="https://cdn.shopify.com/s/files/1/0805/3379/files/Furni-clickd.jpg?12824279880080276008" class="furniture-gall-card container" alt="">
<div id="cusm">
<a href="https://www.peterboroughcraftworks.ca/pages/furniture-options">
<img border="0" alt="Hooks & Knobs" src="https://cdn.shopify.com/s/files/1/0805/3379/files/cusm.jpg?12667808716500648615" height="223" width="312">
</a>
</div>
</div>
<div id="produside" class="mcard">
<div id="shop-new">
<a href="https://www.peterboroughcraftworks.ca/collections/craftworks-store">
<img border="0" alt="Shop Online Now!" src="https://cdn.shopify.com/s/files/1/0805/3379/files/welcome-spring.jpg?16540889492977978359" width="640" height="435">
</a>
</div>
<div id="hooksk">
<a href="https://www.peterboroughcraftworks.ca/collections/hooks-knobs">
<img border="0" alt="Hooks & Knobs" src="https://cdn.shopify.com/s/files/1/0805/3379/files/Hooksknobs.jpg?9884174894376543046" width="640" height="217">
</a>
</div>
<div id="spabeaut">
<a href="https://www.peterboroughcraftworks.ca/collections/spa-beauty">
<img border="0" alt="Spa & Beauty" src="https://cdn.shopify.com/s/files/1/0805/3379/files/beautyspa.jpg?9884174894376543046">
</a>
</div>
</div>
</div>
*note the classes of padded row and container are already defined in the complete styles sheet the part below is just a snippet. Maybe the other CSS is overriding my new CSS?
CSS:
#midpage .container .padded-row {
max-width: 900px;
margin: auto;
position: relative;
}
#furnicard .mcardl {
display: inline;
vertical-align: top;
max-width: 100px;
}
#produside .mcardr {
vertical-align: top;
width: auto;
}
.mcardl {
display: inline;
vertical-align: top;
margin-left: auto;
margin-right: auto;
position: absolute;
top: 0px;
left: 0px;
}
.mcardr {
display: inline;
vertical-align: top;
margin-left: auto;
margin-right: auto;
position: absolute;
top: 0px;
right: 0px;
}
#media only screen and (min-width: 480px) and (max-width: 900px) {
.mcardl {
display: block;
width: 100%;
clear: both;
}
.mcardr {
display: block;
width: 100%;
}
#furnicard .mcardl {
display: inline;
vertical-align: top;
max-width: 100px;
}
#produside .mcardr {
vertical-align: top;
width: auto;
}
}
I some how need to incorporate this css back in there.. Should I have had one class of link and then just did the inline styling for it in the HTML?
a.fg-link {
display: inline;
height: 640px;
width: 312px;
z-index: auto;
position: absolute;
left: 0px;
top: 0px;
margin: 0;
}
a.df-link {
display: inline;
text-align: center;
height: 150px;
width: 150px;
z-index: auto;
position: absolute;
left: 10px;
top: 60px;
margin: 0;
}
a.cef-link {
display: inline;
text-align: center;
height: 150px;
width: 150px;
z-index: auto;
position: absolute;
left: 160px;
margin: 0;
top: 60px;
}
a.offi-link {
display: inline;
text-align: center;
height: 150px;
width: 150px;
z-index: auto;
position: absolute;
left: 10px;
margin: 0;
top: 210px;
}
a.bed-link {
display: inline;
text-align: center;
height: 150px;
width: 150px;
z-index: auto;
position: absolute;
left: 160px;
margin: 0;
top: 210px;
}
a.lae-link {
display: inline;
text-align: center;
height: 160px;
width: 150px;
margin: 0;
z-index: auto;
position: absolute;
left: 10px;
top: 380px;
}
a.bii-link {
display: inline;
text-align: center;
height: 160px;
width: 150px;
margin: 0;
z-index: auto;
position: absolute;
left: 160px;
top: 380px;
}
To Review:
Looking to get the layout down with 2 columns, first column featuring the 2 images, and second column featuring the three images. Also need to have those corresponding links positioned on top of the Furniture Gallery image (you'll see that in the OLD JSfiddle). This also needs to be responsive to cellphones/ipads/tablets, I don't care if it pushes them back to vertical stacking as long as they fill the media screen (thus the media query)...
So what do you guys think? I know it's a bit of a mess and I've got lots of questions, but I'd prefer just to get the positioning on my page down and I can somehow figure out the rest! I appreciate any slight help or tips/tricks to fix this!
I have to say you were right it was a mess but I think I've accomplished what you are trying to do.
A couple of tips for learning:
It helps as a matter of structure to come up with a system. There is no need to define a left and right column .mcardl or .mcardr if you define the class in the first place. I just called it mcard
You must double check that your classes in the html match what you've declared in the css. You had some missing dashes in the css. If you leave those out your styles will not impact the html.
You do not need to define the same properties in every class in every breakpoint, you has vertical-align: top; properties and display-inline on almost every class and id.
Lastly for your container which was a main issue, if you define the columns there is no need to have max-width: 1000px; AND to define width: 900px;
I've cleaned it up. Let me know if you have more questions and see the below fiddle:
https://jsfiddle.net/gward90/h4L3dyLw/13/
I gave it a try...and this should get you at least a step in the right direction. A couple of notes:
I'm using Flexbox for the layout to fill the space horizontally
You should use an image map to have separate links for the image areas, I have already implemented one for you, but the rest would follow suit.
HTML
<div id="mid-page" class="container padded-row">
<div id="furni-card" class="mcardr">
<img src="https://cdn.shopify.com/s/files/1/0805/3379/files/Furni-clickd.jpg?12824279880080276008" class="furniture-gall-card container" alt="" usemap="#mymap">
<map name="mymap">
<area alt="" title="" href="https://www.peterboroughcraftworks.ca/collections/dining-furniture" shape="rect" coords="0,60,150,220" style="outline:none;" target="_self" />
</map>
<div id="cusm">
<a href="https://www.peterboroughcraftworks.ca/pages/furniture-options">
<img border="0" alt="Hooks & Knobs" src="https://cdn.shopify.com/s/files/1/0805/3379/files/cusm.jpg?12667808716500648615" height="223" width="312">
</a>
</div>
</div>
<div id="produside" class="mcardl">
<div id="shop-new">
<a href="https://www.peterboroughcraftworks.ca/collections/craftworks-store">
<img border="0" alt="Shop Online Now!" src="https://cdn.shopify.com/s/files/1/0805/3379/files/welcome-spring.jpg?16540889492977978359" width="640" height="435">
</a>
</div>
<div id="hooksk">
<a href="https://www.peterboroughcraftworks.ca/collections/hooks-knobs">
<img border="0" alt="Hooks & Knobs" src="https://cdn.shopify.com/s/files/1/0805/3379/files/Hooksknobs.jpg?9884174894376543046" width="640" height="217">
</a>
</div>
<div id="spabeaut">
<a href="https://www.peterboroughcraftworks.ca/collections/spa-beauty">
<img border="0" alt="Spa & Beauty" src="https://cdn.shopify.com/s/files/1/0805/3379/files/beautyspa.jpg?9884174894376543046">
</a>
</div>
</div>
</div>
CSS
#mid-page {
display: flex;
justify-content: space-around;
}
img {
width: 100%;
height: auto;
}
a {
display: inline-block;
width: 100%;
height: 100%;
}
Is this close to what you're looking for?

Image width dynamic height overlay

I am trying to build an overlay (mouseover) on a image with dynamic height:
<div id="one-third">
<div class="over_menu">Text</div>
<div class="menu_bg"><img src="one.jpg" class="resp-img"></div>
</div>
CSS
.one-third { width: 33.3333%; }
.menu_bg img { width: 100%; height: auto; }
.menu_bg { position:relative; width: 100%; }
.over_menu { position: absolute; z-index:2; background-color:rgba(0,0,0,0.5); color: #FFFFFF; height: 100%; }
Unfortunately the height of "over_menu" is too large, it shows until the whole rest of the page. How else can I fix this?
Give position: relative; to the parent, so that its boundaries are within it:
.one-third { width: 33.3333%; position: relative; }
You should move the over_menu to inside menu_bg
<div id="one-third">
<div class="menu_bg">
<div class="over_menu">Text</div>
<img src="one.jpg" class="resp-img">
</div>
</div>
Of course you should change your :hover condition as well. It would be helpful if you could add a JSFiddle to your question.

Image inside div container has a 5px gap at the bottom

If you go to my Website that i am working on:
http://lastdeath.de/kaufmannmike/wallpaper.html
You can see 2 images (img) both inside 2 different div elements.
Something is weird there. The images have 5 bottom pixels, even if I
don't set it anyways. I've just put an img element in a class="content" and then in div id="breaker/boxer" , nothing really complicated.
But the code just don't want to work.
i can make a line code of an img, then there are no problems with these 5 pixels on the bottom. But i need to put the img in a div container.
Code:
body {
background-color: #fafafa;
margin: 0;
padding: 0;
}
.content {
overflow: hidden;
padding-top: 80px;
}
img {
height: 100%;
width: 100%;
}
<div class="content">
<div max-height="480px" id="breaker">
<img src="http://lastdeath.de/kaufmannmike/img/2_work/wallpaper/breaker-wallpaper_long.jpg">
</div>
<div id="boxer">
<img src="http://lastdeath.de/kaufmannmike/img/2_work/wallpaper/boxer-wallpaper_long.jpg">
</div>
</div>
How to fix this?
just set your img to display:block
why? because default value of img is display:inline
so instead of this:
img {
height: 100%;
width: 100%;
}
you should have this:
img {
display:block;
height: 100%;
width: 100%;
}
Here is a working snippet based on your code taken from your site:
body {
background-color: #fafafa;
margin: 0;
padding: 0;
}
.content {
overflow: hidden;
padding-top: 80px;
}
img {
display:block;
height: 100%;
width: 100%;
}
<div class="content">
<div max-height="480px" id="breaker">
<img src="http://lastdeath.de/kaufmannmike/img/2_work/wallpaper/breaker-wallpaper_long.jpg">
</div>
<div id="boxer">
<img src="http://lastdeath.de/kaufmannmike/img/2_work/wallpaper/boxer-wallpaper_long.jpg">
</div>
</div>

how do I align an image between text?

So I've been working on a page with text and an image. However, I can't find a way to put the image between the text. either it stays on the top left, or it only centers horizontally. here is the code that is of importance:
<style>
body {
margin: 0;
background-image: url("rainbowbg.png");
}
div #hype {
margin-left: auto;
margin-right: auto;
display: block;
positon: relative;
}
#hypetop {
position: fixed;
top: 0;
width: 100%;
}
#hypebot {
position: fixed;
bottom: 0;
width: 100%;
}
.hypetext {
font-family: Impact, Charcoal, sans-serif;
font-size: 64px;
text-align: center;
}
</style>
<body>
<div>
<h1 class="hypetext" id="hypetop">DIRE</h1>
<img id="hype" src="DIREHYPE.png" width="224" height="224">
<h1 class="hypetext" id="hypebot">HYPPPPPPPPPPPE</h1>
</div>
</body>
If anyone knows how I could get the image centered between the text, that would be great.
You can use this responsive css code. It may be help for you. Try it.I can change only position:fixed to position:relative.
Live Working Demo
HTML Code:
<div>
<h1 class="hypetext" id="hypetop">DIRE</h1>
<img id="hype" src="http://s30.postimg.org/qnju89rkx/banner.png" width="224" height="224"/>
<h1 class="hypetext" id="hypebot">HYPPPPPPPPPPPE</h1>
</div>
CSS Code:
body {
margin: 0;
background-image: url("rainbowbg.png");
}
div #hype {
margin:auto;
display: block;
position: relative;
margin-top:50px;
}
#hypetop {
position: relative;
top: 0;
width: 100%;
}
#hypebot {
position:relative;
bottom: 0;
width: 100%;
}
.hypetext {
font-family: Impact, Charcoal, sans-serif;
font-size: 64px;
text-align: center;
}
Result:
Remove position:fixed; from hypetop and hypebot. This caused these elements to have fixed positions and not relative to the image.
you have to imagine them as blocks first. From what I get .. you need 3 blocks in the horizontal order: paragraph | image | paragraph , which gives us the following structure:
<p></p><img></img><p></p>
what you are missing is.. that you need to use the span tag instead fo a tag to make them not break. Which is opposite of making the page responsive (using )
simply put them like this:
<span>
<span id="test"><h1></h1></span>
<img src="" width="200px" height="200px" />
<span id="test"><h1></h1></span>
</span>
#test {
position: relative;
height: 200px;
width: 200px;
text-align: center;
display: block;
}
giving the above css rules... puts the text into a invisible/transparent block.. because we are not declaring any backround-color value. thus all 3 blocks become equal size.. 200px by 200px .. side-by-side in one line..

Inline-block conainting image with height 100% collapsing in FireFox

I have a problem with CSS that's only visible in FireFox (cur.ver. 31).
I am trying to make a responsive layout, with a row of images (with links), that are centered, and having the same height and scale with the viewport width. My approach is to create a container with a fixed aspect ratio, and place the images inside (each image inside a separate <a> tag), center them, and scale their heights to the container height. It's working great, except in FireFox.
To achieve this I applied a display: inline-block; height: 100% to <a> tag and height: 100%; width: auto to <img> tags. For some (unknown) reason FF is not calculating the width of the <a> tag correctly (when it contains described above <img> tag) and it collapses horizontally. The result is, that all <a> with 0 width are placed very close to each other (separated only by white spaces), and the images overlap each other. I get the same result with display: block; float: left; on <a> tags.
The CSS
.container-ratio {
width: 100%;
height: 0;
position: relative;
padding-bottom: 10%;
background: #ddd;
}
.container-inner {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: #ddf;
text-align: center;
}
.block {
display: inline-block;
height: 100%;
background: #f00;
}
.block img {
height: 100%;
width: auto;
display: block;
}
The HTML
<div class="container-ratio">
<div class="container-inner">
<a class="block">
<img src="http://placehold.it/100x80/42bdc2/FFFFFF&text=No1">
</a>
<a class="block">
<img src="http://placehold.it/150x80/242bdc/FFFFFF&text=No2">
</a>
<a class="block">
<img src="http://placehold.it/200x80/c242bd/FFFFFF&text=No3">
</a>
</div>
</div>
I think this is what your trying to do. Demo
You had no width on .block and auto on .block img.
It needs to be percentages.
.container-ratio {
width: 100%;
height: 0;
position: relative;
padding-bottom: 10%;
background: #ddd;
}
.container-inner {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: #ddf;
text-align: center;
}
.block {
display: inline-block;
width:20%;
height: 100%;
background: #f00;
}
.block img {
height: 100%;
width:100%;
display: block;
}
It's been nearly two years since this question was asked, and Firefox still exhibits this behavior.
So, for anyone in the same situation, here's a solution (only tested on Chrome 49.0 and Firefox 45.0.1).
Edit:
Originally, I used inline wrapper divs and two instances of the images, one of which was not displayed and only served as a dummy. It appears this is not necessary, as can be seen here.
All in all, it seems you can't use inline-block that way in Firefox, but all you need to do to get what you want is leave the anchors and images as inline elements. As long as the anchor's parent is a block-level element other than inline-block, and its height is specified, then you'll get the intended result.
If, for some reason, inline-block is really needed, I don't see how to work around this problem.
Note:
Beware of the "font-size: 0;" on the .block class, used to remove spaces between the images. Without this, images are seperated by whitespaces that behave like links. If the images need some space between them, adding some right or left margin as in the fiddle would be a solution.
Also, though the .block class name is no longer appropriate, I left it to stay consistent with the OP.
The modified CSS
.container-ratio {
width: 100%;
height: 0;
position: relative;
padding-bottom: 10%;
background: #ddd;
}
.container-inner {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: #ddf;
text-align: center;
}
.block {
font-size: 0;
}
.block img {
height: 100%;
margin-right: 1%;
}