Wrapper does not expand until all data is loaded - css

On this image I labeled in red #container1 and its child #container2. #container2 has three column divs labeled in blue.
I took this snapshot in the moment both containers were not expanded because of delayed load of external apps (addThis, Facebook, Adsense). After that both containers expand as expected. Anyway, I always see pictures (col2) and col1 displaying before #container2 is expanded. (fraction of a second delay but it exists)
#container1{
text-align:center;
width:926px;
padding:15px; margin-left:12px;
margin-bottom:10px;
border:thin solid #999;
-moz-border-radius:20px;
-webkit-border-radius:20px;
border-radius:20px;
box-shadow: inset 0 0 15px #CCC;
-moz-box-shadow: inset 0 0 15px #CCC;
-webkit-box-shadow: inset 0 0 15px #CCC;
min-heigt:950px
}
#container2 {
width: 980px;
text-align:left; /* reset text alignment */
margin:0 auto;
position:relative;
background-color:white;
border: thin solid #999;/*#69c7e8;*/
border-top:none;
box-shadow: 0px 5px 8px #CCC, -5px 5px 8px #CCC, 5px 5px 8px #CCC;
-moz-box-shadow: 0px 5px 8px #CCC, -5px 5px 8px #CCC, 5px 5px 8px #CCC;
-webkit-box-shadow: 0px 5px 8px #CCC, -5px 5px 8px #CCC, 5px 5px 8px #CCC;
min-height:1000px;
}
#col_1{
float:left;
width:200px;
margin-left:0;
text-align:left;
}
#col_2{
float:left;
width:566px;
text-align:left;
}
#col_3{
float:right;
width:160px;
margin-right:0;
text-align:left; }
As you can see in the picture #container1 expands immediately to its min-height value while #container2 does not.
Anyway I don't like this patch using min-height.
Is it possible to expand both containers at the same time contents are displayed?

Related

Shadow to the left, right and the bottom

I am using this code:
border-right:0px solid #ddd;
height:85px;
box-shadow :5px 5px 10px 1px #eaeaea;
but i just got this results http://codepen.io/anon/pen/MpmPYq
I want to add the same width with shadow at left, buttom and the right side
I'll add this shadow to the dropdown menu at this site http://94.247.169.169/~welloteket/
If you want all four sides shadowed, try this following code:
div {
-webkit-box-shadow: 0 0 100px #000;
box-shadow: 0 0 100px #000;
}
I tested this on CodePen aswell, http://codepen.io/anon/pen/RpVeRG, It is because your Y and X is offset.
If you are looking for the left, right and bottom to be shadowed.
You can use the following code instead:
-moz-box-shadow: 0px 3px 8px rgb(100,100,100);
-webkit-box-shadow: 0px 3px 8px rgb(100,100,100);
box-shadow: 0px 3px 8px rgb(100,100,100);
http://codepen.io/anon/pen/Ppmxoa
Try this code :
div {
height: 200px;
width: 300px;
margin: 50px auto 0;
border-right: 0px solid #ddd;
height: 85px;
box-shadow: 5px 5px 10px 1px #eaeaea, -5px 5px 10px #eaeaea;
}
<div></div>

How to add a shadow for underline (bottom border) in css

In my case I wanted to increase the gap between text and the underline (it is hearder). So I used border-bottom property to do that.But in here I want to use text-shadow, and same shadow for the underline (which in my case is bottom border). how can I do that.
html
<h1 class="headerone">stackoverflow</h1>
css
h1.headerone{
border-bottom:2px solid black;
text-shadow:0 0 5px black;
/* text-decoration:underline; I didn't use this because gap is low */
}
find fiddle demo
h1.headerone{
text-shadow:0 0 5px black;
/* text-decoration:underline; I didn't use this because gap is low */
position:relative;
}
h1.headerone:before{
content:'';
position:absolute;
bottom:-2px;
left:0;
width:100%;
height:2px;
background:#000;
box-shadow:0 0 5px black;
}
Try this css it may help you.
h1.headerone{
border-bottom:2px solid black;
text-shadow:0 0 5px black;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
/* text-decoration:underline; I didn't use this because gap is low */
}
Fiddle Demo
in css :
h1.headerone{
border-bottom:2px solid black;
text-shadow:0 0 5px black;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
}
<h1 class="shadow">stackoverflow</h1>
CSS Fiddle Demo
h1.shadow {
text-shadow:0 0 5px black;
max-width: 200px;
}
h1.shadow::after {
margin-top: 20px; /* distance goes here */
display: block;
content: ' ';
height: 2px;
background: black;
box-shadow: 0 0 5px black;
}

css - shadow on right and left

hi there i am using the following code to get a shadow on the right and left side of a div tag but all four sides of the div are shadowed...
.shadow1 {
border-right:1px solid #8d8d8d;
border-left:1px solid #8d8d8d;
-moz-box-shadow:0px 0px 5px 0px #000;
-webkit-box-shadow: 0px 0px 5px 0px #000 ;
box-shadow: 0px 0px 5px 0px #000;
}
is there a way to get the shadow appear only on the right and left side of the div... ?? any help would be appreciated... thanks in advance... :)
This seems to work ok :)
box-shadow: 5px 0px 5px -4px #000,
-5px 0px 5px -4px #000;
EDIT: Oh, I'm waaay late :p looks like we came to more or less the same conclusion tho.
try this:
jsFiddle
div {
width:200px;
height:200px;
margin:20px;
border:1px solid #8d8d8d;
-weibkit-box-shadow: 5px 0px 10px -5px #000, -5px 0px 10px -5px #000;
-moz-box-shadow: 5px 0px 10px -5px #000, -5px 0px 10px -5px #000;
box-shadow: 5px 0px 10px -5px #000, -5px 0px 10px -5px #000;
}
Try this : http://css3-drop-shadows.herokuapp.com/app
It provides a css3 generator at the end.
It uses :before and :after

Centering just the DIV instead of the sidebar too

I have a header, a sidebar, and a content div.
The Header is docked to the top and fixed there. The sidebar is fixed the to the left. Now I have 3/4 of the screen on the right free of space. I have a content div that I want to place there. It needs to be centered in that 3/4 space.
Here is my code for the sidebar and content div.
CSS:
html,body {
height:100%;
}
#sidebar {
float: left;
width: 300px;
background: #fff;
background: rgba(225,225,225,0.2);
height:100%;
}
#sidebarTop {
height:100%;
background-color: #eee;
padding:20px 50px;
border-bottom:0.15em solid rgb(229,229,229);
background: rgba(225,225,225,0.25);
box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
-o-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
-webkit-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0px 1px rgba(255,255,255,0.3), inset 0px 0px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset -10px 0px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
}
#content {
margin: 0 auto;
display:block;
width:400px;
margin-top:100px;
height:900px;
background:#FFF;
-webkit-box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
-moz-box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
}
Here is my HTML code for sidebar and content div.
<div id="sidebar">
<div id="sidebarTop">
....
</div>
</div>
<div id="content">
TEST
</div>
The problem comes here. What happens is that instead of ignoring the sidebar and pushing the content div to 100px down (margin-top:100px), it brings the side-bar down to the same level too.
My goal is to center that div both vertically and horizontally in that 3/4 of screen space left after the sidebar and the header fill the rest.
Any help is much appreciated!
Add float:left; to #content.
#content {
margin: 0 auto;
width:400px;
margin-top:100px;
height:900px;
background:#FFF;
-webkit-box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
-moz-box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
}
should be:
#content
{
margin:100px auto 0;
width:400px;
height:900px;
background:#fff;
-webkit-box-shadow:0 0 30px #fff;
-moz-box-shadow:0 0 30px #fff;
box-shadow:0 0 30px #fff;
float:left;
}
Updated:
CSS
html,
body
{
height:100%;
}
#sidebar
{
position:fixed;
top:0;
left:0;
width:300px;
height:100%;
background-color:#758;
}
#content
{
margin-left:-50px;
position:absolute;
top:100px;
left:50%;
width:400px;
height:900px;
background:#758;
}​
HTML
<div id="sidebar">
"fixed" sidebar
</div>
<div id="content">
"horizontally centered" content
</div>​
DEMO
Update 2:
CSS
#wrapper
{
position:absolute;
top:100px;
left:300px;
right:0;
height:900px;
}
#content
{
margin:0 auto;
width:400px;
height:100%;
background:#758;
}
HTML
<div id="sidebar">
"fixed" sidebar
</div>
<div id="wrapper">
<div id="content">
"horizontally centered" content
</div>
</div>​​​​​​​​​​
DEMO 2
You could try in this way:
CSS:
html,body {
height:100%;
}
#sidebar {
border: 2px solid yellow; /*Added to show the box-model*/
float: left;
width: 25%;
background: #fff;
background: rgba(225,225,225,0.2);
height:100%;
}
#sidebarTop {
border: 2px solid black; /*Added to show the box-model*/
height:100%;
background-color: #eee;
padding:20px 50px;
border-bottom:0.15em solid rgb(229,229,229);
background: rgba(225,225,225,0.25);
box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
-o-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
-webkit-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0px 1px rgba(255,255,255,0.3), inset 0px 0px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset -10px 0px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
}
#foo {
border: 2px solid pink; /*Added to show the box-model*/
margin-top: 100px;
margin-left: 27%;
width: 73%;
}
#content {
border: 2px solid green; /*Added to show the box-model*/
margin: 0 auto;
display:block;
width:400px;
/*margin-top:100px;*/ /*this can be deleted*/
height: 100%;
background:#FFF;
-webkit-box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
-moz-box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
box-shadow: 0px 0px 30px rgba(255, 255, 255, 1);
}
And HTML:
<div id="sidebar">
<div id="sidebarTop">
....
</div>
</div>
<div id="foo">
<div id="content">
TEST
</div>
</div>
#sidebarTop {
margin: 0 auto;
}
You can simply use "center" tag like this:
<div id="content">
<center>
TEST
</center>
</div>

Using more than one color for CSS box shadow

I'm attempting to use a dark shadow color on three sides of a div, and a light "glow" on one side -- essentially using two different colors for the CSS box shadow. So far the best solution I've come up with is to place a shadow on all sides but one, and use a second div with a glow, and a third div to hide the glow on all but one side with margins and overflow-hidden. I was just wondering if there might be a better (CSS-only) method than the one I'm implementing? Any ideas?
Demo here - http://swanflighthaven.com/css-shadow-glow.html
It doesn't look nearly as nice on a light background:
http://swanflighthaven.com/css-shadow-glow2.html
#main {
max-width:870px;
min-width:610px;
margin:0px auto;
position:relative;
top:40px;
min-height:400px;
}
#maininside {
position:relative;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
overflow:hidden;
padding:0px 25px 25px 25px;
}
#maininner {
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
overflow:hidden;
box-shadow: 0px 0px 28px rgba(0, 0, 0, 0.80);
-moz-box-shadow: 0px 0px 28px rgba(0, 0, 0, 0.80);
-webkit-box-shadow: 0px 0px 28px rgba(0, 0, 0, 0.80);
min-height:385px;
padding:0px 15px 15px 15px;
background:url(center.png) repeat;
}
#glow {
position:absolute;
height:50px;
top:0px;
box-shadow: 0 -10px 20px -5px #7b272c;
-moz-box-shadow: 0 -10px 20px -5px #7b272c;
-webkit-box-shadow: 0 -10px 20px -5px #7b272c;
display: block;
position:absolute;
height:auto;
bottom:0;
top:0;
left:0;
right:0;
margin-right:25px;
margin-left:25px;
margin-bottom:25px;
}
<div id="main">
<div id="glow">
</div>
<div id="maininside">
<div id="maininner" ></div>
</div>
</div>
You can just write multiple shadows, comma separated:
{
box-shadow: 0px 0px 28px rgba(0, 0, 0, 0.80), 0 -10px 20px -5px #7b272c;
}
See https://developer.mozilla.org/En/CSS/Box-shadow
try negative spread values in the box-shadow css
Instead of creating the second div with the fancy margins and the hiding, try to play around with a negative spread value. It reduces the bleeding on the sides that you don't want your shadow to show up on. Play around with the example on my jsfiddle, set the spread to 0, -10, -5... you'll get the hang of it quick.
#glow {
/* x y blur spread color */
box-shadow: /* ie */
0px -10px 15px -6px rgba(255,000,000,0.7), /* top - THE RED SHADOW */
0px 5px 15px 0px rgba(000,000,000,0.3), /* bottom */
5px 0px 15px 0px rgba(000,000,000,0.3), /* right */
-5px 0px 15px 0px rgba(000,000,000,0.3); /* left */
-webkit-box-shadow:
0px -10px 15px -7px rgba(000,255,000,0.7), /* top - THE RED SHADOW */
0px 5px 15px 0px rgba(000,000,000,0.3), /* bottom */
5px 0px 15px 0px rgba(000,000,000,0.3), /* right */
-5px 0px 15px 0px rgba(000,000,000,0.3); /* left */
-moz-box-shadow:
0px -9px 10px -8px rgba(000,000,255,0.9), /* top - THE RED SHADOW */
0px 5px 10px 0px rgba(000,000,000,0.3), /* bottom */
5px 0px 10px 0px rgba(000,000,000,0.3), /* right */
-5px 0px 10px 0px rgba(000,000,000,0.3); /* left */
}
body {
padding: 10%;
background-color: #fefefe;
}
div {
height: 300px;
width: 300px;
margin: 0px auto;
border-radius: 2pt;
border: 1px solid rgba(0,0,0,0.8);
background-color: #fefefe;
}
<div id="glow"></div>
I had to play around with the properties a bit to get them to look similar in the different browsers. Mozilla/FF was the biggest pain. Look at how much the values differ... it's kind of a tedious game of cat and mouse off-setting the blur with spread...
box-shadow is used in IE.
webkit is used in Chrome.
moz is used in Firefox.
http://jsfiddle.net/CoryDanielson/hSCFw/

Resources