CSS header doesn't go center - css

I'm trying to get navigation bar of height 40px on the top which I've now, Also I position:fixed; the only problem is, everything what I put inside the divs he showing up to the right and not at the center which I want, the navigation bar need to be 100%
JS Fiddle
this is my .css code:
.container{
height:auto;
margin-top:-10px;
margin-left:-7px;
}
/*========================= TOP HEADER =========================*/
.banner{
margin: 0pt auto;
width:100%;
background-color:#d9d8d6;
border-style:solid;
border-width:1px;
border-color:#000000;
position:fixed;
position: absolute;
}
.banner-container{
height:40px;
background-image:url('http://i.imgur.com/WoVWvmy.png');
background-size:40px 30px;
background-repeat:no-repeat;
position:center;
text-align:center;
}
These divs I use in index.php
<div class="container">
<div class="banner">
<div class="banner-container">
</div> <!-- END BANNER-CONTAINER -->
</div> <!-- END BANNER -->
</div> <!-- END CONTAINER -->

I restructured a little bit. Please see: JS Fiddle
HTML
<div class="banner">
<div class="banner-container"></div>
<!-- END BANNER-CONTAINER -->
</div>
<!-- END BANNER -->
CSS
body {
margin: 0;
}
/*========================= TOP HEADER =========================*/
.banner {
margin: 0pt auto;
width:100%;
background-color:#d9d8d6;
border-style:solid;
border-width:1px;
border-color:#000000;
position:fixed;
}

Here's your best bet.
Note I changed the HTML to use an img tag. It's easier to center these, and to manage them in general, than to do the same with CSS backgrounds:
<div class="container">
<div class="banner">
<img src="http://i.imgur.com/WoVWvmy.png" class="banner-container" />
</div> <!-- END BANNER -->
</div> <!-- END CONTAINER -->
CSS:
.container{
height:auto;
}
/*========================= TOP HEADER =========================*/
.banner{
width:100%;
background-color:#d9d8d6;
border-style:solid;
border-width:1px;
border-color:#000000;
text-align: center;
}

Related

Invoice template, header <div> alignment issue

I have this template that we have been given to edit, all I want it to insert a top header div with a height of 25px and background colour, which I did, but it won't align correctly at all. I took it outside the wrapper, and increased it's width, but it still aligns slightly right.
I've added the original template below -
<head>
<title>[DOCUMENT_TITLE]</title>
</head>
<body>
<div id="pdfdoc">
<div id="wrapper">
<div id="header">
<div id="logo"><center><img src="[LOGOFILE]"></center></div>
<div class="sender-address">
<div class="sender-address-company">[SENDER_ADDRESS_COMPANY]</div>
<div class="sender-address-line1">[SENDER_ADDRESS_LINE1]</div>
<div class="sender-address-line2">[SENDER_ADDRESS_LINE2]</div>
<div class="sender-address-line3">[SENDER_ADDRESS_LINE3]</div>
<div class="sender-address-line4">[SENDER_ADDRESS_LINE4]</div>
<div class="sender-address-postcode sender-address-line4">, </div>
<div class="sender-address-postcode">[SENDER_ADDRESS_POSTCODE]</div>
</div>
<div id="header-info">
<div id="vat-registration-info">[VATNUMINFO]</div>
<div class="sender-address-phone">T: [SENDER_ADDRESS_PHONE]</div>
<div class="sender-address-email">E: [SENDER_ADDRESS_EMAIL]</div>
</div>
<div class="cl" id="logo_clearer"></div>
</div>
</div>
</body>
</html>
CSS
html {width:793px;}
*,html,body{ font-family:[FONT]; color:[FONTCOLOR]; }
body {
font-size:[FONTSIZE]px;
}
#wrapper {
margin:0 40px 0 40px;
}
#pdfdoc {
font-size:1.1em /*increase font size for everthing from user-set body pt size */
}
/* header */
#pdfdoc #header{
margin-top:2em;
border-bottom:1px solid #E5E5E5;
padding-bottom:24px;
margin-bottom:48px;
position:relative;
}
#logo{
float:left;
margin-right:24px;
margin-left:24px;
text-align:center;
vertical-align: middle;
}
.sender-address {
font-size:1.1em;
float:left;
}
.sender-address-company{ font-weight:bold;font-size:1.1em;}
.sender-address-line4{ float:left;}
.sender-address-potcode{ float:left;}
#header-info{
float:right;
text-align:right;
position:absolute;
bottom:0; right:0;
margin-bottom:24px;
}
#header-info div{ color:#808080; }
#pdfdoc #header div a:link{ text-decoration:none; color:#808080;}
How can I get the added Div centrally aligned in template?
http://jsfiddle.net/5RhFq/16/ - looks fine on here but on here - https://app.kashflow.com/v2/documents/invoice/89BAFB30-CF7C-4A14-98C3-37BD6D8C14CC?media=0&theme=396345 It doesn't.
body {
margin:70px auto;
font-size:[FONTSIZE]px;
}

Cant centre div in another div

I have a div in that div there are two other div. One has got to be on the left side and the other must be in the center but is with margin 0 when i check
<div class="row">
<!-- START LOGO -->
<div id="logo" class="span3">..</div>
</div>
<!-- END LOGO -->
<!-- START MENU - TOPBAR -->
<div id="nav-topbar" class="span9">...</div>
</div>
and this is the css
.row{
width:100%;
}
.span3{
float:left;
position:absolute;
width 270px;
}
.span9{
margin-left:auto;
margin-right:auto;
width:870px;
}
HTML
<div class="row">
<!-- START LOGO -->
<div id="logo" class="span3">..</div>
<!-- END LOGO -->
<!-- START MENU - TOPBAR -->
<div id="nav-topbar" class="span9">...</div>
<!-- END TOPBAR -->
</div>
CSS
Note: I have added black borders so you can see the outline of the divs.
.row{
width:100%;
}
.span3{
border:1px solid black;
float:left;
width:270px;
}
.span9{
border:1px solid black;
left:50%;
margin-left:-435px;
position:absolute;
width:870px;
}

How do I change the css so lowering one class does not lower the other?

I have two css classes. One is supposed to hold images of text on the left side of the page and the other is supposed to hold a form on the right side of the page. For some reason, when I increase the padding to try to lower the text images on the left side of the page, the form on the right side also goes down. How can I fix it so that I can adjust the padding on both the classes independantly. Here is the css:
.header { background:url(images/slider_bgpng200.png) top repeat-x; padding:0; margin:0 auto; }
.header .headertop{width: 100%; background: #d3e5e8; height: 30px;}
.block_header {margin:0 auto; width:1200px; padding:0; border:none; }
.formbox{float: right;}
.logo { float:left; padding:0; margin:0; width:242px;}
.slider { background: transparent; margin:0 auto; padding:0; height:383px;}
.slider .gallery { margin:0 auto; width:980px; height:383px; padding:0;}
.slider .textholder {padding-top: 100px;}
And here is how it appears in the html:
<div class="header">
<div class="headertop">
<div class="header_text">Email | Client Login </div>
</div>
<div class="block_header">
<div class="logo"><img src="logo.png" width="242" height="94" border="0" alt="logo" />
</div>
<div class="slider">
<div class="gallery">
<div class="textholder"> <img src="images/textimg.png"></div>
<div class="formbox">Form is here </div>
</div>
</div>
</div>
</div>
Thanks. The website is up at avidest.com/schneer.
Add a float:left to the textholder.
.slider .textholder {float:left;padding-top: 100px;}
I also recommend using a inspecting tool to see what is actually happening. In this case you would have noticed that the textholder is a block-element that uses the full width of the container.

div overlapping footer despite of style="clear:both"?

I am writing my own template for joomla 2.5.6. I am not sure if this issue is Joomla or simply css related.
The template is simple, it has a sidebar on the left and content on the right, and a footer. Now when the content is short and there are several modules on the sidebar, the modules overlap the footer.
It looks like this:
http://imageshack.us/photo/my-images/269/screenshotmdph.jpg/
The html from index.php looks like this:
<body>
<div class="container_6">
<div class="grid_6 header">
<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/assets/images/logo.png" alt="home" id="logo"/>
<jdoc:include type="modules" name="menu" />
</div>
</div>
<div class="container_6">
<div class="grid_6 head_logo">
<jdoc:include type="modules" name="header_logo" />
<div class="left_menu">
<div class="left_menu_content">
<jdoc:include type="modules" name="left_menu" style="xhtml" />
</div>
</div>
<div class="right_module">
<jdoc:include type="modules" name="right" />
</div>
</div>
</div>
<div class="container_6">
<div class="grid_6">
<div class="content">
<div class="content_holder">
<!-- beginn content -->
<div class="container_6">
<div class="content_component">
<jdoc:include type="modules" name="breadcrumb" />
<jdoc:include type="component" />
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<div class="container_6">
<div class="grid_6">
<div class="footer">
</div>
</div>
</div>
I have used the 960-grid system which has the class clear on it, but the other classes are defined here:
.header {
background: url('../images/top.png') no-repeat;
height:93px;
width:100%;
}
.head_logo {
background: url('../images/shadow.png') repeat-y;
padding-right:10px;
padding-left:12px;
z-index:1;
position:absolute;
}
.left_menu {
background: url('../images/menuBg.png') no-repeat;
width:284px;
min-height:611px;
top:300px;
z-index:2;
position:absolute;
}
.right_module {
width:180px;
height:40px;
padding:10px;
background-color:#e9e9e9;
top:300px;
left:730px;
z-index:3;
position:absolute;
}
.content {
background: url('../images/shadow.png') repeat-y;
min-height:500px;
}
.content_holder {
background-color:#e9e9e9;
width:960px;
margin-left: auto;
margin-right: auto;
min-height:500px;
}
.content_component {
width:666px;
padding:5px 5px 5px 284px;
margin:0 5px;
}
#logo {
margin:15px 0 0 25px;
float:left;
}
.footer{
background: url('../images/bottom.png') no-repeat;
width:100%;
height:92px;
}
I am lost with this, because it should work because of the clearing class above the footer, but it doesn't.. Unfortunatedly I have no online example, its all local
Anybody an idea how I could find the error? Thank you so much
ADDITIONAL INFORMATION:
Sorry, I forgot, the
<div class="clear"></div>
Is defined in the grid.css, and looks like this:
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
I edited the question title also, sorry was wrong
Addition!!
I wanted to add a screenshot of the problem. Please look here:
http://www.bilder-hochladen.net/files/jegt-i-6f49-jpg.html
You see, the .left-menu is positioned with absolute and begins inside the .head-logo class. The .left-menu should not go inside the purple footer.
How can I tell the content divs to be equal in height with the left-menu?
Use Clear:both instead of clear:all which is not a style definition in MHO.
From what it seems, you may be placing the 'clear' div in a wrong place, but it's hard to say, not seeing the actual page with all the css attached, including the grid ones. Maybe you would be able to actually generate the page, save to your local disk and put it online?

Div is not resizing when text is inserted

I have a simple CSS fixed width layout with a container and some backgrounds, and a three column design.
<body>
<form id="form1" runat="server">
<div id="BGContainer">
<div id="PageContainer">
</div>
<div id="Content">
<div id="MainContent">
<asp:ContentPlaceHolder ID="MainAreaContentPlaceholder" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
<div id="Bottom">
<div id="Copyright">
Copyright
</div>
</div>
</div>
</form>
</body>
In a different file, I have the content for the ContentPlaceHolder
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainAreaContentPlaceholder">
<div id="Heading">
Overskrift
</div>
<div id="LeftColumn">
/*Content Here*/
</div>
<div id="CenterColumn">
center
</div>
<div id="RightColumn">
right
</div>
</asp:Content>
The problem is that #MainContent is not resizing in height. It always stays the same height
CSS
html {
height:100%;
}
body {
margin:0;
width:100%;
height:100%;
font-family: Verdana, Sans-Serif;
background-image:url(../Gfx/Design/bg.png);
background-repeat:repeat;
}
#BGContainer {
margin:0px;
background-image:url(../Gfx/Design/Background-top-gradient.png);
background-repeat:repeat-x;
height:210px;
width:100%;
}
#PageContainer {
background-image:url(../Gfx/Design/top-gradient.png);
background-repeat:no-repeat;
height:100%;
width:1016px;
margin-left:auto;
margin-right:auto;
}
#Bottom {
background-image:url(../Gfx/Design/Bottom.png);
background-repeat:no-repeat;
height:32px;
width:964px;
margin-left:auto;
margin-right:auto;
}
#Content {
background-color:#FFFFFF;
background-image:url(../Gfx/Design/content-background.png);
background-repeat:no-repeat;
width:1000px;
height:100%;
margin-left:auto;
margin-right:auto;
}
#MainContent {
width:980px;
height:100%;
margin-left:auto;
margin-right:auto;
background-color:#FFFFFF;
}
#Copyright {
color:#000000;
font-size:xx-small;
text-transform:uppercase;
margin-left:50px;
padding-top:5px;
}
#LeftColumn {
width:311px;
margin-left:10px;
border: 1px solid gray;
min-height:400px;
float:left;
}
#CenterColumn {
width:311px;
margin-left:10px;
border: 1px solid gray;
min-height:400px;
float:left;
}
#RightColumn {
width:311px;
margin-left:10px;
margin-right:10px;
border: 1px solid gray;
min-height:400px;
float:right;
}
To clear the floats without any additional markup use overflow:hidden
#MainContent {overflow:hidden;zoom:1;}
The zoom:1 will invoke hasLayout in ie6 so the float will clear in ie6.
The three columns (#LeftColumn, #CenterColumn, #RightColumn) are all floats, so they will not increase the height of #MainContent. Try putting a div (which can be empty) just after those three with clear: both. That will force it to sit below the three columns, and #MainContent will be at least tall enough to include this new div.
If your problem is instead that #MainContent is too tall, note that it has height: 100%, which you could remove (and then apply the above fix). Hope that helps.
You need to clear the floated content.
Insert as follows:
<div id="MainContent">
<asp:ContentPlaceHolder ID="MainAreaContentPlaceholder" runat="server">
</asp:ContentPlaceHolder>
<div class="clear"></div>
</div>
... and the CSS:
.clear{clear:both}
use the <p> tag and your text will resize depending on content needs
<div style="width:400px; border-bottom:1px solid teal; padding:20px;">
<p>your text or database field here</p>
</div>
I use the tag when i want a div height to change depending on the amount of text inside.
This example will give you a nice results list when querying from database that places a border in-between results.
Probably because you have a height set on the #BGContainer - if you remove this you might find that the box expands with the text

Resources