box shadow in css - css

How can i get these spaces covered with this box shadow?
CSS-
.button
{
height:24px;
width:120px;
background:black;
position:absolute;
border-radius:2px;
padding:3px;
box-shadow:4px 4px 0px 0px #444;
}
Just a fiddle

Changing the h-shadow and v-shadow will position the shadow on the box.
If you want the shadow to be closer, change the distance of the shadow.
Test it here

Using close shadows might not get you that much effect. Instead you can use background properties and positions... Here is a good example.

Try this:-
.button
{
height:24px;
width:120px;
background:black;
position:absolute;
border-radius:2px;
padding:3px;
box-shadow:2px 2px 0px 2px #444; // changed
}

Related

CSS ::before property not showing in Chrome

I am using Datatbale 1.10.10
In the Buttons Colvis I have set it to Multicolumn Layout.
I have added this CSS to get the checkbox in the buttons. But it doesn't show on the second column in Chrome, but does get displayed in the Firefox.
https://stackoverflow.com/a/32701608/4017803
Here is the CSS code snippet
.dt-button-collection a.buttons-columnVisibility:before,
.dt-button-collection a.buttons-columnVisibility.active span:before {
display:block;
position:absolute;
top:1.2em;
left:0;
width:12px;
height:12px;
box-sizing:border-box;
}
.dt-button-collection a.buttons-columnVisibility:before {
content:' ';
margin-top:-6px;
margin-left:10px;
border:1px solid black;
border-radius:3px;
}
.dt-button-collection a.buttons-columnVisibility.active span:before {
content:'\2714';
margin-top:-11px;
margin-left:12px;
text-align:center;
text-shadow:1px 1px #DDD, -1px -1px #DDD, 1px -1px #DDD, -1px 1px #DDD;
}
.dt-button-collection a.buttons-columnVisibility span {
margin-left:20px;
}
Check box works with single column.
So I have converted single column to look like multi-column.
buttons container width double than the buttons width and float left to the buttons.
But this is just a temporary solution. But I would like to know how to fix the multicolumn layout in Chrome.

IE11 (other IE?) background color and border

The following styles causes the issue shown in the image. As you can see the background-color doesn't fill correctly. Any thoughts?
.button{
font-size:18px;
line-height:46px;
color:#57595E;
text-align:center;
display:block;
width:158px;
height:46px;
border-radius:5px;
border:1px solid #57595E;
}
.button:hover{
color:#fff;
background-color:#57595E;
}
Turns out a mixin I was using was adding background-clip: padding-box; and this was causing the issue.

Nested divs Background-color

I am trying to change background-color of the parent div behind the children ones. Kind of like how the how the background in this image is darker than the other divs.
here is my HTML:
<div class="main">
<div class="sub">
</div>
</div>
CSS:
div.main {
background-color:#AAAAAA;
}
div.sub {
border-style:solid;
border-width:1px;
border-color:#AAAAAA;
border-radius:2px;
margin:10px;
box-shadow: 0px 0px 5px #AAAAAA;
}
The main div is not the color #AAAAAA
Thanks, Ben
You forgot to add background-color in sub class and also add padding for the clear view.
div.main {
background-color:#AAAAAA;
padding:20px;
}
div.sub {
border-style:solid;
border-width:1px;
border-color:#AAAAAA;
border-radius:2px;
margin:10px;
box-shadow: 0px 0px 5px #AAAAAA;
padding:10px;
background-color:#fff;
}
I tried doing the same thing, it may help: JSFiddle
just assign a different background color to your different divs, maybe add some padding to make it show?
div.main {
background-color:#888888; //<---------- darker
padding: 10px; //<-------- padding
}
div.sub {
border-style:solid;
background-color:#AAAAAA; //<---------- lighter
border-width:1px;
border-color:#AAAAAA;
border-radius:2px;
margin:10px;
box-shadow: 0px 0px 5px #AAAAAA;
}

Text overlapping with drop-down

I have CSS code from a template design that a client wants to use. One of the issue I'm having is that, once a text option is selected (those options with wide length) is writing over the drop-down arrow.
See image
I have tried using z-index and placing overflow:hidden where appropriate. Here is the CSS code:
/* search drop-down values */
select option {}
option.level-0{padding:0 3px;}
option.level-1,option.level-2,option.level-3,
option.level-4,option.level-5,option.level-6,
option.level-7{}
.selectBox-dropdown{ height: 34px; min-width:190px; max-width: 320px; position:relative; border:solid 1px #BBB; line-height:1; text-decoration:none; color:#666; outline:none; vertical-align:middle; background:#FFF; -webkit-border-radius:6px; -moz-border-radius:6px; border-radius:6px; display:inline-block; cursor:default; margin-top: 1px\9; height: 33px\9;}
.content_right .selectBox-dropdown {width:303px;}
.content_right a.selectBox-dropdown:hover {text-decoration:none;}
.selectBox-dropdown:focus,
.selectBox-dropdown:focus .selectBox-arrow{border-color:#BBB}
.selectBox-dropdown.selectBox-menuShowing{-moz-border-radius-bottomleft:0; -moz- border-radius-bottomright:0; -webkit-border-bottom-left-radius:0; -webkit-border-bottom-right-radius:0; border-bottom-left-radius:0; border-bottom-right-radius:0}
.selectBox-dropdown .selectBox-label{width:100%; padding:0 .7em; line-height:2.4em; display:inline-block; white-space:nowrap; overflow:hidden; font-size:14px}
.selectBox-dropdown .selectBox-arrow{position:absolute; top:0; right:0; width:23px; height:100%; background:url(images/sb-arrow.png) 50% center no-repeat; border-left:solid 1px #BBB; }
.selectBox-dropdown-menu{position:absolute; z-index:99999; max-height:200px; border:solid 1px #BBB; background:#FFF; -moz-box-shadow:0 2px 6px rgba(0,0,0,.2); -webkit-box-shadow:0 2px 6px rgba(0,0,0,.2); box-shadow:0 2px 6px rgba(0,0,0,.2); overflow:auto}
.selectBox-inline{width:250px; outline:none; border:solid 1px #BBB; background:#FFF; display:inline-block; -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px; overflow:hidden;}
.selectBox-inline:focus{border-color:#666}
.selectBox-options,
.selectBox-options li,
.selectBox-options li a{list-style:none; display:block; cursor:default; padding:0; margin:0}
.selectBox-options li a{color:#666; padding:1px .7em; white-space:nowrap; overflow:hidden; background:6px center no-repeat; text-decoration:none; font:14px/1.5em Arial,Helvetica,sans-serif;}
.selectBox-options li.selectBox-hover a{background-color:#EEE}
.selectBox-options li.selectBox-disabled a{color:#888; background-color:transparent}
.selectBox-options .selectBox-optgroup{color:#666; background:#EEE; font-weight:bold; line-height:1.5; padding:0 .3em; white-space:nowrap;}
.selectBox.selectBox-disabled{color:#888 !important}
.selectBox-dropdown.selectBox-disabled .selectBox-arrow{opacity:.5; filter:alpha(opacity=50); border-color:#666;}
.selectBox-inline.selectBox-disabled{color:#888 !important}
.selectBox-inline.selectBox-disabled .selectBox-options a{background-color:transparent !important}
code for the drop-down:
<div class="state-dropdown"><?php wp_state_dropdown() ?></div>
<span id="campus_dropdown"><?php if (empty($_GET['cp_state'])){ wp_campus_dropdown();} ?></span>
<?php if (!empty($_GET['cp_state'])){?>
<script type="text/javascript" >loadXMLDoc('<?php echo $_GET['cp_state'];?>','<?php echo $_GET['cp_your_college'];?>')</script>
<?php }?>
Any suggestions or help would be greatly appreciated. I know this is a bit too much of CSS, but again its from a template and I have been pulling my hair out for weeks!
Thank you so much in advance!
First of all without sample HTML, we can only guess at how the css is used. After analyzing the css you provided, I took a stab at how I thought it might be used, jsFiddle here. Based on this assumption there are two options:
Set a right padding for the elements that contain the menu options. This may cause the dropdown to widen, but should be better as it will allow users to see the entire text of the option.
Set the background for the dropdown arrow element ('.selectBox-arrow') to a solid color and match the border radius of the containing element. Note that the background color defaults to transparent.
If for whatever reason neither of these options work in your situation, remember, Firebug (or other browser's developer tools) are your friend. These tools can help make short work of problems like this.

Why doesn't the title tooltip work for floated elements?

I have a floated element, the whole purpose of which is to display an 'x' signifying that you can remove something:
.remove_button{
background-color:#ff3300;
color:#ffffff;
font-family:Courier New,sans-serif;
font-weight:900;
font-size:20px;
float:right;
border-radius:5px;
padding:0px 6px 0px 6px;
margin-right:15px;
}
<div class="remove_button" title="Remove">x</div>
It does display a neat little 'x' over a red background (no need to make a picture, I'm bad at that), but the problem is that when the mouse hovers over the button the title attribute shows up inside the button, and as a tooltip too:
------xRemove------ one '-' is one pixel of padding
try this,
.remove_button{
background-color:#ff3300;
color:#ffffff;
font-family:Courier New,sans-serif;
font-weight:900;
font-size:20px;
float:right;
border-radius:5px;
padding:0px 6px 0px 6px;
margin-right:15px;
position:relative;
}
​ .tip{
position:absolute;
display:none;
border:1px solid #aab;
background:#eef;
padding:0 3px;
left:15px;
top:25px;
}
.remove_button:hover .tip{
display:block;
}
​​​​​​​​​

Resources