Padding messing with background color - html

I got a problem with my footer background. It seems like the height of the #pagefooter is 0 and the background color is only applied to the padding, vertical which 2x 25px.
I tried several things, but i didn't find a solution.
What's wrong here?
///THE HTML
<div id="pagefooter">
<footer>
<nav id="f1" class="footernav">
<h1>Misc</h1>
</br>
<ul>
<li>
Lorem
</li>
<li>
ipsum
<li>
<li>
dolor
</li>
<li>
sit
</li>
<li>
amet
</li>
</ul>
</nav>
<nav id="f2" class="footernav">
<!-- SOME MENU -->
</nav>
<nav id="f3" class="footernav">
<!-- SOME MENU -->
</nav>
<nav id="f4" class="footernav">
<!-- SOME MENU -->
</nav>
</footer>
</div>
///THE CSS
#pagefooter {
background-color: #1a1a1a;
padding:25px 100px;
}
.footernav {
float:left;
width:25%;
margin-bottom: 35px;
}
Here's an example: http://jsfiddle.net/AR3AC/

Basically, #pagefooter contains only floated elements which make the parent element have no height (and therefore no background colour). To work around this, set the overflow property to auto:
#pagefooter {
background-color: #1a1a1a;
padding: 25px 100px;
overflow: auto;
}

The height of the pagefooter is never set as far as I can tell. Add a line into #pagefooter so like this to explicitly state the height you want:
#pagefooter {
background-color: #aaa;
height: 100px;
padding:25px 100px;
}
I'm not sure if that answers your question, but that's a good place to start.

Now and then I'll get an issue with overflow:auto. In case you do, another way to deal with this is to put an empty clearing div right before . It can just be <div style="clear:both"></div>. (I generally make a class ".clear" which has clear:both. Makes it easy to troubleshoot this sort of thing by just testing with a <div class="clear"></div> to see if floats are the issue.

Related

CSS not styling properly - will not work (bizarre)

I don't even know where to start on this one. When I resize below 1600px the site breaks 100% even though it has media queries in place to resize/hide/move elements. But to pinpoint one issue that eludes me, I have a logo in an id that is set to a height of 175px and width to auto. At any browser size it's always a height of 564px. Check out some code below:
img #fpa-logo {
bottom: -25px;
height: 175px;
margin-left: 12.5%;
position: absolute;
width: auto;
}
<div class="row">
<div class="col-sm-12 nav" id="nav-w-back">
<div class="col-sm-5 fLeft">
<img src="../images/FPA-logo-new150-02.png" alt="FPA Logo" id="fpa-logo">
</div>
<div class="col-sm-7">
<ul class="nav fRight" id="nav-ul">
<li>Home</li>
<li>Services<span style="font-size: .75em"> ▼</span>
<ul>
<li>Personalized Care</li>
<li>Health Care Services</li>
</ul>
</li>
<li>Links<span style="font-size: .75em"> ▼</span>
<ul>
<li>Patient Information and Forms</li>
<li>Patient Friendly Sites</li>
</ul>
</li>
<li>Staff Bios</li>
<li>Careers</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
If you're interested in more code - the test site is: http://fpacny.com/index_test.php where you can play with the sizing etc. At this point you would likely notice that the main image background only resizes properly when an inline HTML style addition of:
style="height: auto; width: 100%;"
is added. Otherwise, that breaks too.
Why won't my linked CSS override this? I've never had this issue on any website I've developed and it is driving me absolutely nuts!
JSFiddle: https://jsfiddle.net/hjo8pLxe/
You need to write
img#fpa-logo
to target the logo.
Edit: Just saw you are using bootstrap 4: Why not use the "img-fluid" class on the image? Then it won't get too big and scale down automatically if the row/column gets smaller.
<img class="img-fluid" {...} >
Or do you need any special behaviour, other than automatic resizing?
And you should also look more into the column features of bootstrap, you are using a lot of position: absolute in your css which is not needed at all for your design and would prevent a lot of errors if you would use bootstrap instead.
Change your ccs to
img#fpa-logo {
bottom: -25px;
height: 175px;
margin-left: 12.5%;
position: absolute;
width: auto;
}

Adding a left logo to my navigation bar

I'm trying to set my company logo on my header navigation bar with no luck. I tried by adding before the nav itself but it's not centering the content. The image is shown first and the messy menu after that.
<header>
<img src="http://i.imgur.com/jNwTPBi.png">
<nav id="nav" class="ry">
<ul id="main-menu">
<li>
</i>Home
</li>
<li>
</i>About
</li>
<li>
</i>Our work
</li>
<li>
</i>Work
</li>
<li>
</i>Contact
</li>
</ul>
</nav>
</header>
You can try it right here, by adding <img src="http://i.imgur.com/jNwTPBi.png">: http://codepen.io/anon/pen/XKKPGO
How can I put the logo on the left so I can get something like the following solution? I guess I've to make some changes on the .css but I dont know what do I have to edit.
Thanks in advance.
Your CSS is over whelming. All you would need to do is give/create the wrapper a position of relative and the logo the position absolute.
<header>
<div class="wrapper"> ..
<img src="http://i.imgur.com/jNwTPBi.png" class="logo"> ..
header .wrapper {
width: 1100px;
margin: 0 auto;
position: relative;
}
header .wrapper .logo {
position: absolute;
left: 0;
}
i think it's super easy, so i think it might answer ur question
<header>
<div class="with_class">
<img src="">
</div>
<nav></nav>
</header>
put a wrapper div on your image and put an absolute position with it.
width whatever div width u want and height same as ur header. have you ever tried it before?

Bootstrap 3 two menu header with big logo

I'm a bootstrap 3 newbie, so please be gentle with me :) I know i'm going completely down the wrong route here. I've tried several approaches, this was just the latest. I've searched for bootstrap 3 websites doing the same thing, so i could learn from them, but can find any (some similar) but not with the big logo)
All I want is a big logo on the left taking up the full height of my header (about 100px) then small menu top right Contact us | Blog | Apply and main menu center bottom of the header space (but not under the logo) starting next to it (ideally centered) with 5 menu options. I tried to add a picture but it wont let me.
heres what I have : `
<style>
.smallmenu {
color: white;
background-color: #003300;
padding-right: 20px;
float: right;
font-size: 12px;
line-height: 50px;
}
.mainmenu {
background-color: #0000cc;
color: white;
padding-left: 200px;
float: right;
line-height: 30px;
font-size: 16px;
}
.logo {
background-color: #f11f18;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 logo">
<img src="img/logo_en2.png" alt="logo">
</div>
<div class="smallmenu">
<ul class="list-inline">
<li> Contact Us</li>
<li> Apply Now</li>
<li> Blog</li>
</ul>
</div>
<div class="col-lg-10 mainmenu">
<ul class="list-inline">
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
<li>Menu 5</li>
</ul>
</div>
</div>
</div>
`
the coloured backgrounds are just to help me see where things go.
Of course as soon as I resize this, it falls apart. if someone could point me in the right direction.. with how the structure should be.. should I use navbars? should I be using col-xx-xx or not in a header? is it just one row, or should it be 2?
I guess on mobile it should have logo and small top menu and the main menu should be stacked.
Really appreciate any help with structure, site to look at or code samples I can learn from.
Thanks
First bit of advice I would give is start with the broad layout - where all the stuff on the screen is going to go - before you get down to trying to style menus etc. because you never know when inheritance is going to break something.
Is this (fiddle) basically what you're looking fro?
The key concept is:
<div class="row">
<div class="col"></div>
<div class="col">
<div class="row"></div>
<div class="row"></div>
</div>
</div>

Dropdown menu broke

I have being trying to find a solution with a menu i have on a custom html website that it is not appearing but i can't for some reason find a solution and i'm quite curious what i'm doing wrong.
<div class="header_area fix" id="header">
<div class="header_top fix">
<div class="left_logo floatleft fix">
<img src="img/logo.png" alt="Burning Desire Stoves Fireplace and Fire Centre" />
</div>
<div class="main_menu floatright fix">
<button style="floatright" id="mobile_button">Menu</button>
<ul>
<li>Home</li>
<li>Showroom</li>
<li class="dropdown">Stoves
<ul>
<li>Woodburning Stoves</li>
<li>Multifuel Stoves</li>
</ul>
</li>
<li>Fireplaces</li>
<li>Fires
<ul>
<li>Gas Fires</li>
<li>Electric Fires</li>
</ul>
</li>
<li>Case Studies</li>
<li>Contact</li>
</ul>
</div>
</div>
You can check the website here
The site is a for a client of mine he said he added some extra menu option without touching the css and then the menu broke. More importanly the dropdown of the menu is not appearing and i was trying to make come the surface with some display:block or z-index with no luck.
Also he has add a PHP CMS called Couch which is adding tag.
To give you a better idea the following code as actually a snippet and it is located in a most likely cms path "editor/snippets/header"
.main-menu>ul>li>ul {
position:absolute;
}
Your Menu Has a Dropwown but it is not hidden , so it takes some space. and the header has oveflow hidden, so the menu is becoming hidden entirely.
Add this css and your menu will be shown,
but you need to add code for dropdown to work.
This CSS is all kinds of jacked up.
The issues:
overflow: hidden on the .fixed element is causing the text to disappear.
As far as I can tell, there's no CSS that displays the drop down lists on hover
The drop down lists aren't hidden, so they're taking up space forcing the main list out of the nav bar
There's still list-style-type:disc for the li elements
I'll fiddle with it for a minute, but those are the issues.
Update I fiddled with the CSS and got the dropdowns to display. You'll have to make them look pretty with some CSS, but they're working. Yeah, it's kind of hacky, but I did what I could with the 5? CSS sheets all competing for screen time.
/* menu extra css */
.dropdown:hover .dropdown-hidden {
display:block;
}
.dropdown-hidden {
float: none!important;
display: none;
position: absolute;
z-index: 99999999;
left: 0px;
background: #fff;
}
.dropdown-hidden li {
display: block;
float: none!important;
position: relative;
}
.fix {
overflow: inherit!important;
}
li {
list-style-type: none;
}
-
<ul>
<li>Home</li>
<li>Showroom</li>
<li class="dropdown">
Stoves
<ul class="dropdown-hidden">
<li>Woodburning Stoves</li>
<li>Multifuel Stoves</li>
</ul>
</li>
<li>Fireplaces</li>
<li>Fires
<ul class="dropdown-hidden">
<li>Gas Fires</li>
<li>Electric Fires</li>
</ul>
</li>
<li>Case Studies</li>
<li>Contact</li>
</ul>

Make menu and image appear on the same line

I want to make my menu and image appear on the same line but sadly that doesn't seem to be happening. Could anyone tell me why and how I would solve my problem? I've got the following image and menu...
HTML
<div id="header">
<img alt="" height="67" src="Aidanlogo.png" width="400" />
<div id="myslidemenu" class="jqueryslidemenu">
<ul>
<li>Home</li>
<li>Blog</li>
<li>About</li>
<li>Contact</li>
</ul>
<br style="clear: left" />
</div>
</div>
Menu CSS: http://pastebin.com/drMD7gwg
Header CSS
#header {
width: 700px;
margin-left: auto ;
margin-right: auto ;
}
try this
#menu ul li { display: inline; }
Divs are block elements, so by default it will always appear on a separate line.
You could make the image a block and float it left (display:block; float:left;)
You could make your div display:inline-block, or float:right; it, assuming there's room in the parent (700px).
DIV is a block element, so it won't display on the same line as anything else unless you change it's inline property:
#myslidemenu { display:inline; }
Also note that you'll have to modify the <ul> styles to display the <li> tags on a single line. See this link for more on that part.
edit I'm not sure what the jQuery slide menu does to the <div> or <ul> styles - you might have a look in Firebug after it's rendered.