CSS: How to limit length of the border-bottom div? - css

the picture below has 2 divs, 1 is the part where the login form and the other is where the buttons on facebook and twitter, then I want is to put a border but with a specific length, which would where is the red box.
The width of first div is: 850px and the second is: 30% over the first!
I hope I have explained!
HTML
<div id="top">
<!--Productos de limpieza Master Clean <img src="media/user_icon.png"/><span>Inicia sesión ó <a href="registro.php" id="registro">registrate!</b></span>-->
<div id="loginform">
<form id="loginuser" name="loginuser" action="php/processFunctions.php" method="post">
<input id="userLog" class="required" name="userLog" type="text" placeholder="Usuario"/>
<input id="passLog" class="required" name="passLog" type="password" placeholder="Contraseña"/>
Iniciar ó
Registrarse
<span id="errorlogin"></span>
</form>
</div>
<span id="currentUser"></span>
<!--<h4>Búscanos en:</h4>-->
</div>
<div id="topsocial">
<ul id="socialmedia">
<li><img src="media/twitter.png" alt="Siguenos" title="Siguenos en Twitter"/></li>
<li><img src="media/facebook.png" alt="Like" title="Like en Facebook"/></li>
</ul>
</div>
CSS
#top {
height:50px;
background:white;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left: 4px;
-webkit-border-top-right: 4px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-topright: 4px;
-webkit-box-shadow: 0px 0px 18px rgba(50, 50, 50, 0.79);
-moz-box-shadow: 0px 0px 18px rgba(50, 50, 50, 0.79);
box-shadow: 0px 0px 18px rgba(50, 50, 50, 0.79);
border: 5px solid black;
border-bottom:none;
}
#topsocial{
width:30%;
padding: 5px;
border-bottom-left-radius: 50% 75%;
border-bottom-right-radius: 50% 75%;
background:white;
overflow:hidden;
float:right;
position: relative;
-webkit-box-shadow: 0px 8px 16px rgba(50, 50, 50, 0.79);
-moz-box-shadow: 0px 8px 16px rgba(50, 50, 50, 0.79);
box-shadow: 0px 8px 16px rgba(50, 50, 50, 0.79);
border: 5px solid black;
border-top: none;
}
I've have another question, how quit or delete box-shadow from top to second div #topsocial?

You can set the first <div> to the size of the box with the border and the second <div> can be placed in absolute position and cover the border.
I've made a jsFiddle to show you how to do it. We don't have your HTML so I hoped it helps anyway.

Supplying the markup and CSS would help get a more useful answer, but the first suggestion would be to make a new <div> which will contain the login form and the rounded border inside the 850px wrapping <div>. Then set a width on the inside <div> that is to the left of the facebook and twitter block, but overlap the border slightly. Then extend the 30% <div> to the top.
UPDATE: http://jsfiddle.net/zFa9n/

I have put a little change only on your CSS code that works fine for any screen width, and give you the result you need, I hope you like it.
#top {
height:50px;
background:white;
border: 5px solid black;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left: 4px;
-webkit-border-top-right: 4px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-topright: 4px;
-webkit-box-shadow: 0px 0px 18px rgba(50, 50, 50, 0.79);
-moz-box-shadow: 0px 0px 18px rgba(50, 50, 50, 0.79);
box-shadow: 0px 0px 18px rgba(50, 50, 50, 0.79);
}
#topsocial{
position: relative;
top:-5px;
width:30%;
float:right;
padding: 5px;
border: 5px solid black;
border-top: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
background:white;
overflow:hidden;
-webkit-box-shadow: 0px 8px 16px rgba(50, 50, 50, 0.79);
-moz-box-shadow: 0px 8px 16px rgba(50, 50, 50, 0.79);
box-shadow: 0px 8px 16px rgba(50, 50, 50, 0.79);
}

Related

How to add the same border-radius to element and box-shadows of element

I have an element on which i add two box-shadows and I want the corners of the element AND the box shadows to have the same border-radius. Somehow it's not happening.
The element appears with a different border-radius than the first box-shadow, and the first box-shadow appears with a different border radius than the second box-shadow.
Here's the code:
.stack_item{
overflow: hidden;
border-radius: 10px 10px 10px 10px;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
transform: translate(-50%, 9%);
-webkit-box-shadow: 0px -15px 0px -7px rgb(206, 204, 204), 0px -29px 0px -13px rgb(168, 168, 168);
-moz-box-shadow: 0px -15px 0px -7px rgb(206, 204, 204), 0px -29px 0px -13px rgb(168, 168, 168);
box-shadow: 0px -15px 0px -7px rgb(206, 204, 204), 0px -29px 0px -13px rgb(168, 168, 168);
}
Since you are making your shadow shrink, the border-radius is also shrinking.
Set it on a larger pseudo-element and it will be ok
.stack_item{
width: 200px;
height: 100px;
position: relative;
border: solid 1px black;
border-radius: 10px 10px 10px 10px;
margin-top: 50px;
background-color: white;
}
.stack_item:before,
.stack_item:after {
content: "";
position: absolute;
top: 0px;
bottom: 50px;
border-radius: inherit;
}
.stack_item:before {
left: 7px;
right: 7px;
box-shadow: 0px -8px 0px 0px rgb(206, 204, 204);
z-index: -1;
}
.stack_item:after {
left: 13px;
right: 13px;
box-shadow: 0px -16px 0px 0px rgb(168, 168, 168);
z-index: -2;
}
<div class="stack_item"></div>

Box shadow is covering a small portion of the DIV

I have the following Box Shadow css style. Unfortunately it is covering a very small portion on the top of the mainContent DIV. The rest of the DIV length is without any shadow. What am I doing wrong?
.mainContent {width: 85%; margin: auto; max-width:1400px;
-webkit-box-shadow: 0px 9px 26px 5px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 9px 26px 5px rgba(50, 50, 50, 0.75);
box-shadow: 0px 9px 26px 5px rgba(50, 50, 50, 0.75);}
You should set the height property to auto.
jsfiddle
.mainContent {width: 85%; margin: auto; max-width:1400px;
-webkit-box-shadow: 0px 9px 26px 5px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 9px 26px 5px rgba(50, 50, 50, 0.75);
box-shadow: 0px 9px 26px 5px rgba(50, 50, 50, 0.75);
height:auto
}
<div class='mainContent'>
<div style='height:50px; width:50px; border:1px solid'></div>
</div>

CSS absolute property

Fiddle link I want two div with 100% height.
1 div with background image and one color.
both should equally in height in any resolution.
please help me.
.loginImage { width: 100%; }
.loginBox {
background-color: #ffffff;
background: rgba(255, 255, 255, 0.2);
-webkit-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
-moz-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
height: 100%;
position: absolute;
}
<div class="wrapper-login">
<div class="col-xs-6"><img src="images/loginImage.jpg" alt="Cargo CRM" class="loginImage"></div>
<div class="col-xs-3 loginBox"></div>
</div>
Fiddle
.col-xs-6 {
width: 47.66666667%;
display:table-cell;
text-align:left;
}
.col-xs-3 {
width: 25%;
display:table-cell;
text-align:left;
}
.loginImage {
width: 100%;
}
.loginBox {
background-color: #ffffff;
background: rgba(255, 255, 255, 0.2);
-webkit-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
-moz-box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
box-shadow: 1px 0px 9px 0px rgba(50, 50, 50, 0.55);
}
.wrapper-login {
margin: 0 auto;
width: 100%;
display:table;
}
Is it what you are looking for?

CSS Box-Shadow clipped/squared

Hi I have a div at the top of my page
http://www.uk-sf.com/MyTraining.php
the box-shadow is cut on the wrapper, I tried giving it a z-index but no joy any ideas?
.titlebox{
width:977px;
background-color:rgba(48, 48, 48, 1);
padding:10px 5px;
margin: 5px 5px;
font-size: 24px;
border:3px double rgb(138, 138, 138);
-webkit-box-shadow: 0px 0px 51px 7px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 0px 51px 7px rgba(0,0,0,0.75);
box-shadow: 0px 0px 51px 7px rgba(0,0,0,0.75);
}
Help appreciated
Your #contentContainer has overflow:auto; : is it on purpose?
If not, add this to your CSS :
#contentContainer {
overflow: visible;
}
or just delete the overflow:auto declaration from your CSS.
(overflow: auto is asking your contentContainer to clip its content.)

Bootstrap Image Circle Inner Shadow

How can I add an inner shadow to a bootstrap "image-circle"?
jsfiddle
This doesn't work..
.box-shad {
box-shadow: 0 10px 20px #777 inset, 0 0 200px #000 inset, 0 0 150px #000 inset, 0 0 100px #000 inset;
}
<img class="img-circle box-shad" alt="" src="http://placehold.it/140x140"><img class="img-circle box-shad" alt="" src="http://placehold.it/140x140">
Thanks for any ideas.
SOLUTION:
Put the box shadow on a circular div with background image set to the image, rather than using an image.
You can try something like this:
.box-shad {
-webkit-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75);
}
Demo: http://jsfiddle.net/52VtD/1926/
UPDATE
I don't think it's possibile to set an inner shadow because it's an image; you can draw the circle too instead of use an image, so you'll can set the inner shadow.
Code:
.box-shad {
-webkit-box-shadow: inset 0 0 4px #000;
-moz-box-shadow: inset 0 0 4px #000;
box-shadow: inset 0 0 4px #000;
}
.circle {
width: 140px;
height: 140px;
display: inline-block;
border-radius: 50%;
background-color: #aaa;
}
Demo: http://jsfiddle.net/52VtD/1943/
This works to me. Please try it.
.inner-shadow {
box-shadow: inset 3px 3px 4px black;
border-radius: 50%;
}
img {
width: 100%;
border-radius: 50%;
position: relative;
z-index: -10;
}
<div class="inner-shadow">
<img src="http://placehold.it/300x300" alt="">
</div>
Closest I get is this:
http://jsfiddle.net/52VtD/1941/
<div class="border">
<a class="shadow img-circle"><img class="img-circle" src="http://placehold.it/140x140" /></a>
CSS:
.border
{
padding:10px;
width:160px;
}
.shadow
{
display:block;
position:relative;
}
.shadow img
{
display:block;
}
.shadow::before
{
display:block;
content:'';
position:absolute;
width:100%;
height:100%;
-moz-box-shadow:inset 0px 0px 5px 2px rgba(0,0,0,0.2);
-webkit-box-shadow:inset 0px 0px 5px 2px rgba(0,0,0,0.2);
box-shadow:inset 0px 0px 5px 2px rgba(0,0,0,0.2);
}
this article may help http://designbystevie.com/2011/03/applying-css3-inset-box-shadows-to-images/

Resources