Stop text from breaking to next line - css

How do I stop the text in my webpage from breaking to the next line. Its a navigation bar.
I tried both: 'whitespace: nowrap;' and 'overflow: hidden;' which gives me this result:
. The text doesn't break to the next line, but the drop down menus don't work and the text 'Arc Studios' is cut off on the top and bottom.
How do I stop the text from breaking to the next line, while still keeping all of the functions (drop-down menus, and the 'Arc Studios' text)?
CSS
p {
text-align: justify;
color: #000000;
text-indent:5px;
}
body {
background: #f5f5f5;
background-image: url('brushed.png');
}
footer {
background: rgb(63,76,107); /* Old browsers */
background: -moz-linear-gradient(top, rgba(63,76,107,1) 0%, rgba(63,76,107,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(63,76,107,1)), color-stop(100%,rgba(63,76,107,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3f4c6b', endColorstr='#3f4c6b',GradientType=0 ); /* IE6-9 */
box-shadow: 0px 1px 3px #000000;
border-radius: 0px;
text-indent: 5px;
position: absolute; right: 0; left: 0;
margin-top: 100px;
}
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
overflow: hidden;
white-space: nowrap;
}
.menu {
margin-top: -8px;
height: 50px;
width: 100%;
position: absolute; right: 0; left: 0;
text-align: left;
background: rgb(63,76,107); /* Old browsers */
background: -moz-linear-gradient(top, rgba(63,76,107,1) 0%, rgba(63,76,107,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(63,76,107,1)), color-stop(100%,rgba(63,76,107,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3f4c6b', endColorstr='#3f4c6b',GradientType=0 ); /* IE6-9 */
box-shadow: 0px 1px 3px #000000;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
}
.menu li {
position: relative;
list-style: none;
float: left;
display: block;
height: 40px;
}
.menu li a { /* Navigation Bar text */
display: block;
padding: 0 20px;
margin: 15px 0;
line-height: 15px;
text-decoration: none;
font-family: sans-serif;
font-weight: bold;
font-size: 12px;
color: red;
/* text-shadow: 1px 1px 1px rgba(255,255,255,0.3); */
-webkit-transition: color .4s ease-in-out;
-moz-transition: color .4s ease-in-out;
-o-transition: color .4s ease-in-out;
-ms-transition: color .4s ease-in-out;
transition: color .4s ease-in-out;
}
.menu li:first-child a{ border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { text-decoration: underline; }
.menu li#navbar-logo:hover > a { text-decoration: none; }
.menu ul {
position: absolute;
top: 35px;
left: 0;
opacity: 0;
background: rgba(63,76,107,1);
border-left: 1px solid #393942;
border-bottom: 1px solid #393942;
border-right: 1px solid #393942;
-webkit-border-radius: 0 0 2px 2px;
-moz-border-radius: 0 0 2px 2px;
border-radius: 0 0 2px 2px;
-webkit-transition: opacity .75s ease .1s;
-moz-transition: opacity .75s ease .1s;
-o-transition: opacity .75s ease .1s;
-ms-transition: opacity .75s ease .1s;
transition: opacity .75s ease .1s;
}
.menu li:hover > ul {
opacity: 1;
}
.menu ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
.menu li:hover > ul li {
height: 35px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 100px;
padding: 10px 0 10px 10px;
margin: 0;
border: none;
border-bottom: 1px solid #353539;
}
.menu ul li:last-child a {
border: none;
}
.menu li#navbar-logo,
.menu li#navbar-about,
.menu li#navbar-shop,
.menu li#navbar-contact,
.menu li#navbar-community {
margin-top: 5px;
}
.menu li#navbar-logo {
margin-top: 3px;
}
.menu li#navbar-logo,
.menu li#navbar-about,
.menu li#navbar-shop,
.menu li#navbar-contact,
.menu li#navbar-community {
margin-left: -13px;
margin-right: 5px;
}
.menu li#navbar-about,
.menu li#navbar-shop,
.menu li#navbar-contact,
.menu li#navbar-community {
margin-left: 5px;
margin-right: 5px;
}
#navbar-logo a{
color: #FFC8C8;
text-shadow: 2px 2px 2px rgba(255, 0, 0, 1);
font-size: 50px;
font-family: Intrique Script Personal Use;
}
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Title of Webpage</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<header>
<nav class="navbar">
<ul class="menu">
<li id="navbar-logo">Arc Studios</li>
<li id="navbar-about">About Us
<ul>
<li>FAQ's</li>
<li>Our Inception</li>
<li>Locations</li>
</ul>
</li>
<li id="navbar-shop">Store
<ul>
<li>Games</li>
<li>OS's</li>
<li>Other</li>
</ul>
</li>
<li id="navbar-contact">Contact
<ul>
<li>Email</li>
<li>Help Centre</li>
</ul>
</li>
<li id="navbar-community">Community
<ul>
<li>Forums</li>
<li>Events</li>
</ul>
</li>
</ul>
</nav>
</header>
<br></br>
<footer class="footer">
<p><small>© Copyright 2013, All rights reserved</small></p>
</footer>
</body>
</html>
I'm new to HTML, excuse me.

You would need to decrease the padding in the .menu li a style as they are still block type elements, and specifying white-space: nowrap; will not make a difference, because the menu items are split between the li's.

Remove the overflow:hidden; to show the entire logo.
As for the wrapping, if you don't want any collapsing, you need to set a min-width or a fixed width on ul.menu.
Otherwise, you could use media queries to adjust the sizing of the menu links at certain breakpoints.

Related

Error in the navigation menu (CSS) with the border of last-child

I have the following piece of code where I am constructing a navigation menu with pure CSS code but there is seeming a problem to me that I can not figure out how to remove out the extra space(padding) between the both sides of the menu means the last and first child.
Plz someone help me out there.
<!DOCTYPE html>
<html>
<head>
<title>Navigation</title>
</head>
<style>
.menu,.sub_menu li,.menu li,.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
text-decoration: none;
}
.menu {
height: 40px;
width: 535px;
background: #4c4e5a;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.menu li {
/*position: relative;*/
list-style: none;
float: left;
/*display: block;*/
height: 40px;
}
.sub_menu li {
display: none;
}
.menu li a {
/*display: block;*/
padding: 0 14px;
line-height: 40px;
/* Border on the left side of the navigation bar */
border-left: 1px solid #393942;
border-right: 1px solid #4f5058;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #f3f3f3;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
.menu li:first-child a {
border-left: none;
}
.menu li:last-child a {
border-right: none;
}
.menu li:hover > a {
color: #8fde62;
}
</style>
<body>
<ul class="menu">
<li>My dashboard</li>
<li>Likes</li>
<li>Views
<ul class="sub_menu">
<li>Documents</li>
<li>Messages</li>
<li>Sign Out</li>
</ul>
</li>
<li>Uploads</li>
<li>Videos</li>
<li>Documents</li>
</ul>
</body>
</html>
If you want the width of the .menu element to fit the containing contents, set the display of the element to inline-block and remove the fixed width.
EXAMPLE HERE
.menu {
height: 40px;
display: inline-block;
/* Other styling.. */
}
Additionally, if you want to remove/change the padding on the last/first a elements:
EXAMPLE HERE
.menu li:first-child a {
padding-left: 0;
}
.menu li:last-child a {
padding-right: 0;
}
As a designer for two years, I've always thought it was best to use this piece of code before I try styling my page:
*{
margin: 0;
padding: 0;
overflow: auto;
font-family: inherit;
list-style-type: none;
list-style-position: inside;
}
I use this on top of all my CSS code to eradicate any annoying padding or margin that comes default with some HTML elements.

Z-index not working on fixed header and fixed drop down menu

I am trying to design a fixed drop down menu that slides and then sits under a fixed header for my website when it's being viewed by smaller view ports. I must not be understanding something correctly because despite setting position properly and using a z-index lower than its parent on the nav, it still does not work correctly. On drop down it slides under the menu button I have created, but over the header and then stays above the header. Here is my code:
HTML:
<header>
<div id="menu-button" class="up">menu</div>
<nav role="primary" class="hide">
<ul>
<li>foobar</li>
<li>foobar</li>
<li>foobar</li>
<li>foobar</li>
<li>foobar</li>
<li>foobar</li>
</ul>
</nav>
</header>
CSS:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
header {
display: block;
float: left;
width: 100%;
height: 50px;
background-color: hsla(0, 0%, 20%, 1);
box-shadow: 0px 2px 8px #222;
position: fixed;
top: 0;
z-index: 99;
}
#menu-button {
display: block;
float: left;
background-color: hsla(0, 0%, 50%, 1);
color: #fff;
border: 2px solid #222;
border-radius: 6px;
padding: .25em .5em;
margin-left: 10px;
margin-top: 10px;
cursor: pointer;
}
.up {
background-image: linear-gradient(hsla(0, 0%, 100%, .2), hsla(0, 0%, 0%, .2));
}
.down {
background-image: linear-gradient(hsla(0, 0%, 0%, .2), hsla(0, 0%, 100%, .2));
}
nav ul {
list-style:none;
width: 100%;
position: fixed;
z-index: -1;
transition: all .6s ease;
-webkit-transition: all .6s ease;
-moz-transition: all .6s ease;
-o-transition: all .6s ease;
}
.hide ul {
top: -500px;
}
.reveal ul {
top: 50px;
}
nav ul li a, nav ul li a:visited {
display: block;
float: left;
width: 50%;
background-color: hsla(0, 0%, 35%, 1);
text-decoration: none;
text-align: center;
color: #fff;
padding: 1em;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
transition: .4s all;
-webkit-transition: .4s all;
-moz-transition: .4s all;
-o-transition: .4s all;
}
nav ul li:nth-child(even) a {
border-right: none;
}
nav ul li:hover a {
background-color: hsla(0, 0%, 50%, 1);
}
jQuery:
$('#menu-button').click(function () {
$(this).toggleClass('down');
$('nav').toggleClass('reveal');
});
Here's the jsfiddle I made for it:
http://jsfiddle.net/kyleshevlin/yaJyK/6/
One way to do this and keep your fixed header requirement is to add a wrapper around the menu button:
<div class='menu-wrap'>
<div id="menu-button" class="up">menu</div>
</div>
<nav role="primary" class="hide">
…
</nav>
Make the menu wrapper the full width/height of the menubar:
.menu-wrap {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: blue; /* just to make it obvious… */
}
Demo fiddle
You cannot have the menu (that you want with a lower z-index) inside the fixed element (which has a bigger z-index).
You have to separate those two, make both of them fixed and put your content below in an absolute positionned container with a top = header height (or a margin-top)
Then both the header and the menu will stay in place, and you can set each z-index independently (like this)
header {
display: block;
width: 100%;
height: 50px;
background-color: hsla(0, 0%, 20%, 1);
box-shadow: 0px 2px 8px #222;
position: fixed;
top: 0;
z-index:1;
}
nav{
position:fixed;
transition: all .6s ease;
-webkit-transition: all .6s ease;
-moz-transition: all .6s ease;
-o-transition: all .6s ease;
width:100%;
}
<header>
<div id="menu-button" class="up">menu</div>
</header>
<nav role="primary" class="hide">
<ul>
<li>foobar</li>
...
Remove the z-index on the parent(header) and add a position:relative.
I had an inner <div> and an outer <div>.
My inner div's z-index was not working because the outer div did not have a z-index defined.
.inner {z-index:999}
.outer {z-index:111} /*<-- explicitly defined*/

Theres no bottom padding in my web page

I'm Having Trouble with my Web Page: There is no bottom padding and it makes my website look weird. I have tried changing the body, and html to margin-bottom: 100px but it does not seem to work. This always seems to happen when I add outsourced navigation bars.
CSS
#charset "utf-8";
/* CSS Document */
html, body { margin: 0; padding:0px;}
body { margin: 5px; background: #f2f2f2; }
ul.menu { margin: 50px auto 0 auto; }
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
/* Menu */
.menu {
height: 40px;
width: 905px;
background: #4c4e5a;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
border:#8fde62 medium solid;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.menu li {
position: relative;
list-style: none;
float:left;
display: block;
height: 40px;
}
/* Links */
.menu li a {
display: block;
padding: 0 14px;
margin: 6px 0;
line-height: 28px;
text-decoration: none;
border-left: 1px solid #393942;
border-right: 1px solid #4f5058;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #f3f3f3;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
.menu li:first-child a { border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { color: #8fde62; }
/* Sub Menu */
.menu ul {
position: absolute;
top: 40px;
left: 0;
opacity: 0;
background: #1f2024;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
}
.menu li:hover > ul { opacity: 1; }
.menu ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
.menu li:hover > ul li {
height: 36px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 100px;
padding: 4px 0 4px 40px;
margin: 0;
border: none;
border-bottom: 1px solid #353539;
}
.menu ul li:last-child a { border: none; }
#wrapper{
width:900px;
height:auto;
margin: 50px auto 0 auto;
}
#xboxcard{
width:300px;
height:500px;
background-color:#4c4e5a;
border:#8fde62 medium solid;
border-radius:5px;
}
#rightcontent{
width:575px;
height:342px;
background-color:#4c4e5a;
border:#8fde62 medium solid;
border-radius:5px;
float:right;
padding: 10px 10px 10px 10px;
position:absolute;
top:150px;
left:495px;
text-align:center;
color:#FFF;
}
#step1{
width:245px;
height:250px;
position:absolute;
top:550px;
left:180px;
text-align:center;
color:#FFF;
padding: 10px 10px 10px 10px;
background-color:#4c4e5a;
border:#8fde62 medium solid;
}
HTML
<body>
<ul class="menu">
<li>Home</li>
<li>Contact</li>
<li>Claim</li>
<li>Proof</li>
</ul> <!-- end .menu -->
<div id="wrapper">
<img src="#" alt="#" height="342" width="245" style=" background-color:#4c4e5a;
border:#8fde62 medium solid;
border-radius:5px;
padding:10px 10px 10px 10px;
" />
<div id="rightcontent">
<h1>This is Some right content!</h1>
</div>
<div id="step1">
</div>
</div>
</body>
</html>
try to add this your css...
#wrapper {
margin-bottom:50px;
}
or however many pixels you want the bottom margin to have
Did you try adding padding to the body element?
body{
padding-bottom: 100px;
}
Hey I setup a jsfiddle for your code to take a look, I tweaked some things, check it out and see what you find useful: http://jsfiddle.net/cVLqu/
Biggest recommendation here is:
position: relative;
on the wrapper and the boxes inside it, that way they expand the wrapper instead of floating around freely.
Also check out this post on css-tricks.com, I found it really helpful:
http://css-tricks.com/dont-overthink-it-grids/

Prob for defining a style with css

I have a little issue with styling my asp.net page :
in the top of the my aspx page I declared :
<head>
<meta charset="utf-8">
<title>CSS3 Menu - Impressionist UI - by Valeriu Timbuc for Design Modo</title>
<link rel="stylesheet" href="css/style.css" media="screen">
<style type="text/css">
html, body { margin: 0; padding: 0; }
body { margin: 5px; background: #f2f2f2 no-repeat top center; }
ul.menu { margin: 5px auto 0 auto; }
</style>
<meta name="robots" content="noindex,follow" />
</head>
In some place I have this code :
<div class="rounded-corners"; style=" margin-left:50px; margin-right:50px; ">
<asp:GridView id="MyGridView"
DataSourceID="MyDataSource1"
AutoGenerateColumns="False"
GridLines="Both"
AllowSorting="True"
AllowPaging="True"
CssClass="mGrid"
PagerStyle-CssClass="pgr"
AlternatingRowStyle-CssClass="alt"
Runat="Server" PageSize="35">
<columns>
<asp:boundfield datafield="FICHIER"
readonly="true"
headertext="Fichier"
ItemStyle-CssClass="CellFile">
</asp:boundfield>
In this latter I tried to use the ItemStyle-CssClass="CellFile" in irder to define a padding-left and a color. So in my css file I Have :
/* Reset */
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
padding-bottom:10px;
}
/* Menu */
.menu {
height: 40px;
width: 468px;
background: #4c4e5a;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: #4c4e5a;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.menu li {
position: relative;
list-style: none;
float: left;
display: block;
height: 26px;
text-align:center;
top: 3px;
left: -2px;
}
/* Links */
.menu li a {
display: block;
padding: 0 14px;
margin: 6px 0;
line-height: 28px;
text-decoration: none;
border-left: 1px solid #393942;
border-right: 1px solid #4f5058;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #f3f3f3;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
.menu li:first-child a { border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { color: #8fde62; }
/* Sub Menu */
.menu ul {
position: absolute;
top: 40px;
left: 0;
opacity: 0;
background: #1f2024;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
}
.menu li:hover > ul { opacity: 1; }
.menu ul li {
height: 28px;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
top: 0px;
left: 0px;
width: 205px;
}
.menu li:hover > ul li {
height: 36px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 125px;
padding: 4px 0 4px 40px;
margin: 0;
text-align:inherit;
border: none;
border-bottom: 1px solid #353539;
}
.menu ul li:last-child a { border: none; }
/* Icons */
.menu a.documents { background: url(../img/docs.png) no-repeat 0px center; width: 125px;}
.menu a.messages { background: url(../img/bubble.png) no-repeat 0px center; width: 125px;}
.menu a.signout { background: url(../img/arrow.png) no-repeat 0px center; width: 125px;}
.mGrid {
width: 100%;
background-color: #fff;
margin: 5px 0 10px 0;
border: solid 1px #525252;
border-collapse:collapse;
border-radius: 0 0 5px 5px;
}
.mGrid td {
padding: 2px;
border: solid 1px #c1c1c1;
color: #717171;
}
.mGrid th
{
/*padding: 4px 2px; */
color: #fff;
background: #4c4e5a;
background: #424242 url(../img/grd_head.png) repeat-x top;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: #4c4e5a;
font-size: 1.2em;
font-variant:small-caps;
text-align : left;
padding-left: 15px;
font-family: Cambria;
}
.mGrid .alt { background: #fcfcfc url(../img/grd_alt.png) repeat-x top; }
.mGrid .pgr { border: 1px solid #424242; background: #424242 url(../img/grd_pgr.png) repeat-x top; }
.mGrid .pgr table { margin: 5px 0; }
.mGrid .pgr td {
border-width: 0;
padding: 0 6px;
border-left: solid 1px #666;
font-weight: bold;
color: #fff;
line-height: 12px;
}
.mGrid .pgr a
{
color: #58ae1b;
text-decoration: none;
background: #4c4e5a;
background: #424242 url(../img/grd_head.png) repeat-x top;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: #4c4e5a;
}
.mGrid .pgr a:hover { color: #000; text-decoration: none; }
.rnd1 {
background-color: #f0ff00;
height: 1px;
}
.gv1 {
width: 100%;
border: 0px none;
}
.gv1 th {
background-color: #C1C4D0;
}
.rounded-corners {
border: 1px solid #424242;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
text-decoration: none;
background: #424242;
background: -webkit-linear-gradient(top, #424242 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #424242 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #424242 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #424242 0%,#2c2d33 100%);
background: #424242;
}
.CellFile
{
padding-left:100px;
color:Aqua;
}
So When I Run the style won't apply but when I delete the <head></head> part the style works fine. I m new to css and asp.net and I guess the prob is somewhere in the styling declaration. How could I make it Work ?
Thank you.
does it make a difference if you make it a self-closing tag?
<asp:BoundField ItemStyle-CssClass="CellFile" />
if not, you might have to make it a template field.

make a header full screen (width) css

I am trying to extend my header to cover the full page. http://dev.webgrowth.biz/ and I want it look like this one http://www.webgrowth.biz/ I have been trying everything for hours now. any help would be highly appreciated.
Live Demo
You can achieve the effect using a container element, then just set the containing elements margin to 0 auto and it will be centered.
Markup
<div id="header">
<div id="headerContent">
Header text
</div>
</div>
CSS
#header{
width:100%;
background: url(yourimage);
}
#headerContent{
margin: 0 auto; width: 960px;
}
Just set the header width to be 100vw to make it full screen width
and set the header height to be 100vh to make it full screen height
#header {
margin: 0;
padding: 0;
width: 100%;
background: xxxx;
}
#header #content {
margin: 0px auto;
width: 800px; /* or whatever */
}
<div id="header">
<div id="content">
stuff here
</div>
</div>
Set the max-width:1250px; that is currently on your body on your #container. This way your header will be 100% of his parent (body) :)
The best way to make the header full screen is set height to be 100vh
#header{
height: 100vh;
}
min-height: 100%;
position: relative;
set the body max-width:110%;
and the make the width on the header 110% it will leave a small margin on left that you can fiX with margin-left: -8px;
margin-top: -10px;
Remove the max-width from the body, and put it to the #container.
So, instead of:
body {
max-width:1250px;
}
You should have:
#container {
max-width:1250px;
}
just do
#RandomDiv{
width: 100%;
}
html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"
</head>
<body>
<ul class="menu">
<li>My Dashboard
<ul>
<li>Learn</li>
<li>Teach</li>
<li>My Library</li>
</ul>
</li>
<li>Likes
<ul>
<li>Pictures</li>
<li>Audio</li>
<li>Videos</li>
</ul>
</li>
<li>Views
<ul>
<li>Documents</li>
<li>Messages</li>
<li>Videos</li>
</ul>
</li>
<li>account
<ul>
<li>Sign In</li>
<li>Register</li>
<li>Deactivate</li>
</ul>
</li>
<li>Uploads
<ul>
<li>Pictures</li>
<li>Audio</li>
<li>Videos</li>
</ul>
</li>
<li>Videos
<ul>
<li>Add</li>
<li>Delete</li>
</ul>
</li>
<li>Documents
<ul>
<li>Upload</li>
<li>Download</li>
</ul>
</li>
</ul>
</body>
</html>
css:
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
body{
max-width:110%;
margin-left:0;
}
.menu {
height: 40px;
width:110%;
margin-left:-4px;
margin-top:-10px;
background: #4c4e5a;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.menu li {
position: relative;
list-style: none;
float: left;
display: block;
height: 40px;
}
.menu li a {
display: block;
padding: 0 14px;
margin: 6px 0;
line-height: 28px;
text-decoration: none;
border-left: 1px solid #393942;
border-right: 1px solid #4f5058;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #f3f3f3;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
.menu li:first-child a { border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { color: #8fde62; }
.menu ul {
position: absolute;
top: 40px;
left: 0;
opacity: 0;
background: #1f2024;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
}
.menu li:hover > ul { opacity: 1; }
.menu ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
.menu li:hover > ul li {
height: 36px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 100px;
padding: 4px 0 4px 40px;
margin: 0;
border: none;
border-bottom: 1px solid #353539;
}
.menu ul li:last-child a { border: none; }
demo here
try also resizing the browser tab to see it in action

Resources