CSS boxes collapsing while zooming out - css

I have a problem related to zooming out on the webpages I am working with.
When the page is zoomed out the boxes are misaligned
Normal Look:
While Zooming Out:
Div Structure
<div class="answerbox shadow">
<div class="content">
<p>What is an Annuity and how does it help with my retirement income?</p>
</div>
<p> <a class="more" href="aboutannunities">Find Out More</a></p></div>
CSS Code:
.answerbox {
height: 125px;
/*Specify Height*/
width: 250px;
/*Specify Width*/
border: 1px solid rgb(217, 217, 217);
border-radius: 3px 3px 3px 3px;
position: relative;
margin-bottom: 15px;
background: -moz-linear-gradient (rgb(20, 255, 255), rgb(230, 230, 230)) repeat scroll 0 0 transparent;
background: -o-linear-gradient(rgb(20, 255, 255), rgb(230, 230, 230)) repeat scroll** 0 0 transparent;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(20, 255, 255)), to(rgb(230, 230, 230))) repeat scroll 0 0 transparent;
/* older webkit syntax */
background: -webkit-linear-gradient(rgb(20, 255, 255), rgb(230, 230, 230)) repeat scroll 0 0 transparent;
word-wrap: break-word;
padding: 7px;
}
.shadow {
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #E6E6E9;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF ), to(#E6E6E9));
background: -webkit-linear-gradient(#FFFFFF , #E6E6E9);
background: -moz-linear-gradient(#FFFFFF , #E6E6E9);
background: -ms-linear-gradient(#FFFFFF , #E6E6E9);
background: -o-linear-gradient(#FFFFFF , #E6E6E9);
background: linear-gradient(#FFFFFF , #E6E6E9);
-pie-background: linear-gradient(#FFFFFF , #E6E6E9);
behavior: url(PIE.htc);
}
Any ideas/suggestions/help will be thankful...
Many thanks...

<div style="width: 540px;float:left;">
Add this in in your CSS:
.answerbox {
float:left;
.....
And try with following code:
<div style="width: 540px;float:left;">
<div class="answerbox shadow">
<div class="content">
<p>What is an Annuity and how does it help with my retirement income?</p>
</div>
<p> <a class="more" href="aboutannunities">Find Out More</a></p></div>
<div class="answerbox shadow">
<div class="content">
<p>What is an Annuity and how does it help with my retirement income?</p>
</div>
<p> <a class="more" href="aboutannunities">Find Out More</a></p></div>
</div>

Related

Inherit from CSS ID

Copied an Arduino example from https://github.com/m1cr0lab-esp32/remote-control-with-websocket. This is using a single LED for websockets, but I need multiple. The backend stuff works fine.
#led {
position: relative;
width: 3em;
height: 3em;
border: 2px solid #000;
border-radius: 2.5em;
background-image: radial-gradient(farthest-corner at 50% 20%, #b30000 0%, #330000 100%);
box-shadow: 0 0.5em 1em rgba(102, 0, 0, 0.3);
}
#led.on {
background-image: radial-gradient(farthest-corner at 50% 75%, red 0%, #990000 100%);
box-shadow: 0 1em 1.5em rgba(255, 0, 0, 0.5);
}
#led:after {
content: '';
position: absolute;
top: .3em;
left: 1em;
width: 60%;
height: 40%;
border-radius: 60%;
background-image: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
}
<div class="panel">
<div id="led" class="%button1%"></div>
<button id="toggle1">Snowman</button>
</div>
I have a total of 5 LED's. Currently I simply copied the CSS stuff 5 times, but there has to be a better way.
Can anyone shine some light on this?
Change your id led to a class and duplicate to match the number of lights you need (i did 5 for the example).
In addition, to be able to target every led by itself via JS or CSS i would add a unique id to every led.
By adding the class on to an element you can turn the light on (see the light for the grinch in the example).
.led {
position: relative;
width: 3em;
height: 3em;
border: 2px solid #000;
border-radius: 2.5em;
background-image: radial-gradient(farthest-corner at 50% 20%, #b30000 0%, #330000 100%);
box-shadow: 0 0.5em 1em rgba(102, 0, 0, 0.3);
}
.led.on {
background-image: radial-gradient(farthest-corner at 50% 75%, red 0%, #990000 100%);
box-shadow: 0 1em 1.5em rgba(255, 0, 0, 0.5);
}
.led:after {
content: '';
position: absolute;
top: .3em;
left: 1em;
width: 60%;
height: 40%;
border-radius: 60%;
background-image: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
}
<div class="panel">
<div id="led1" class="led" class="%button1%"></div>
<button id="toggle1">Snowman</button>
</div>
<div class="panel">
<div id="led2" class="led" class="%button1%"></div>
<button id="toggle2">Pumpkin</button>
</div>
<div class="panel">
<div id="led3" class="led on" class="%button1%"></div>
<button id="toggle3">Grinch</button>
</div>
<div class="panel">
<div id="led4" class="led" class="%button1%"></div>
<button id="toggle4">Santa on the Roof</button>
</div>
<div class="panel">
<div id="led5" class="led" class="%button1%"></div>
<button id="toggle5">Reindeers</button>
</div>

Can i create this structure using css?

Can I create this structure using css? I tried to create this using images, but i need it with css.
Try this, and adapt it to your needs...
body {
padding: 100px;
}
.tabs {
height: 45px;
padding: 0 0 0 0;
overflow: visible;
}
.tab {
width: 200px;
height: 45px;
overflow: hidden;
float: left;
margin: 0 -15px 0 0;
}
.tab-box {
height: 50px;
background: #fff;
border-radius: 4px;
border: 1px solid #ccc;
margin: 0 10px 0;
box-shadow: 0 0 2px #fff inset;
-webkit-transform: perspective(100px) rotateX(30deg);
-moz-transform: perspective(100px) rotateX(30deg);
}
.tab.active {
z-index: 40;
position: relative;
padding-bottom: 1px;
}
.tab.active .tab-box {
background-color: #eee;
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2NjY2NjYyIvPjxzdG9wIG9mZnNldD0iMyUiIHN0b3AtY29sb3I9IiNkZGRkZGQiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZWVlZWUiIHN0b3Atb3BhY2l0eT0iMC41Ii8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
background-size: 100%;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #cccccc), color-stop(3%, #dddddd), color-stop(100%, rgba(238, 238, 238, 0.5)));
background-image: -moz-linear-gradient(top, #cccccc, #dddddd 3%, rgba(238, 238, 238, 0.5));
background-image: -webkit-linear-gradient(top, #cccccc, #dddddd 3%, rgba(238, 238, 238, 0.5));
background-image: linear-gradient(to bottom, #cccccc, #dddddd 3%, rgba(238, 238, 238, 0.5));
box-shadow: 0 0 2px 0 #fff inset;
}
.content {
z-index: 1;
padding: 100px;
border: 1px solid #ccc;
background: #eee;
position: relative;
}
.clear {
clear: both;
}
<div class="tabs">
<div class="tab">
<div class="tab-box"></div>
</div>
<div class="tab">
<div class="tab-box"></div>
</div>
<div class="tab active">
<div class="tab-box"></div>
</div>
<div class="tab">
<div class="tab-box"></div>
</div>
</div>
<div class="content"></div>
You can do, but without rounding
.container {
border-top: solid 10px red;
}
.title {
float: right;
height: 30px;
padding: 0 40px 0 30px;
background-color: red;
position: relative;
}
.title:before {
content: '';
border: solid 30px transparent;
border-top-color: red;
position: absolute;
left: -30px;
top: 0;
}
<div class="container">
<div class="title">Title #1</div>
</div>
Live demo - https://jsfiddle.net/yqnc2j44/1/

Center align pagination bar

I have a problem with my pagination bar - I can't center this bar...
Here is my code:
<div style="pagination">
first<a href=
"#" class="page gradient">2</a><a href="#" class=
"page gradient">3</a><span class=
"page active">4</span><a href="#" class=
"page gradient">5</a><a href="#" class=
"page gradient">6</a><a href="#" class=
"page gradient">last</a>
</div>
<style>
.pagination {
padding: 20px;
margin-bottom: 20px;
color: #666;
font: 14px/24px sans-serif;
}
.page {
display: inline-block;
padding: 0px 9px;
margin-right: 4px;
border-radius: 3px;
border: solid 1px #c0c0c0;
background: #e9e9e9;
box-shadow: inset 0px 1px 0px rgba(255,255,255, .8), 0px 1px 3px rgba(0,0,0, .1);
font-size: .875em;
font-weight: bold;
text-decoration: none;
color: #717171;
text-shadow: 0px 1px 0px rgba(255,255,255, 1);
}
.page:hover, .page.gradient:hover {
background: #fefefe;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FEFEFE), to(#f0f0f0));
background: -moz-linear-gradient(0% 0% 270deg,#FEFEFE, #f0f0f0);
}
.page.active {
border: none;
background: #616161;
box-shadow: inset 0px 0px 8px rgba(0,0,0, .5), 0px 1px 0px rgba(255,255,255, .8);
color: #f0f0f0;
text-shadow: 0px 0px 3px rgba(0,0,0, .5);
}
.page.gradient {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f8f8f8), to(#e9e9e9));
background: -moz-linear-gradient(0% 0% 270deg,#f8f8f8, #e9e9e9);
}
.pagination.dark {
background: #414449;
color: #feffff;
}
.page.dark {
border: solid 1px #32373b;
background: #3e4347;
box-shadow: inset 0px 1px 1px rgba(255,255,255, .1), 0px 1px 3px rgba(0,0,0, .1);
color: #feffff;
text-shadow: 0px 1px 0px rgba(0,0,0, .5);
}
.page.dark:hover, .page.dark.gradient:hover {
background: #3d4f5d;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#547085), to(#3d4f5d));
background: -moz-linear-gradient(0% 0% 270deg,#547085, #3d4f5d);
}
.page.dark.active {
border: none;
background: #2f3237;
box-shadow: inset 0px 0px 8px rgba(0,0,0, .5), 0px 1px 0px rgba(255,255,255, .1);
}
.page.dark.gradient {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#565b5f), to(#3e4347));
background: -moz-linear-gradient(0% 0% 270deg,#565b5f, #3e4347);
}
</style>
I tried everything but it doesn't work...
I tried everything but it doesn't work...
Here is DEMO.
Anyone can help me?
Thanks.
An extra surrounding element ('container') may help here. You can make the bar inline-block and use text-align: center on the parent to center the bar:
.container {
text-align: center;
}
.pagination {
display: inline-block;
Note that you wrote style="pagination" in your code, which should of course be class="pagination", otherwise the CSS won't be applied to the element at all.
Updated fiddle
Try this
.pagination {
padding: 20px;
margin-bottom: 20px;
color: #666;
font: 14px/24px sans-serif;
text-align: center;
}
.page {
display: inline-block;
padding: 0px 9px;
margin-right: 4px;
border-radius: 3px;
border: solid 1px #c0c0c0;
background: #e9e9e9;
box-shadow: inset 0px 1px 0px rgba(255,255,255, .8), 0px 1px 3px rgba(0,0,0, .1);
font-size: .875em;
font-weight: bold;
text-decoration: none;
color: #717171;
text-shadow: 0px 1px 0px rgba(255,255,255, 1);
}
.page:hover, .page.gradient:hover {
background: #fefefe;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FEFEFE), to(#f0f0f0));
background: -moz-linear-gradient(0% 0% 270deg,#FEFEFE, #f0f0f0);
}
.page.active {
border: none;
background: #616161;
box-shadow: inset 0px 0px 8px rgba(0,0,0, .5), 0px 1px 0px rgba(255,255,255, .8);
color: #f0f0f0;
text-shadow: 0px 0px 3px rgba(0,0,0, .5);
}
.page.gradient {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f8f8f8), to(#e9e9e9));
background: -moz-linear-gradient(0% 0% 270deg,#f8f8f8, #e9e9e9);
}
.pagination.dark {
background: #414449;
color: #feffff;
}
.page.dark {
border: solid 1px #32373b;
background: #3e4347;
box-shadow: inset 0px 1px 1px rgba(255,255,255, .1), 0px 1px 3px rgba(0,0,0, .1);
color: #feffff;
text-shadow: 0px 1px 0px rgba(0,0,0, .5);
}
.page.dark:hover, .page.dark.gradient:hover {
background: #3d4f5d;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#547085), to(#3d4f5d));
background: -moz-linear-gradient(0% 0% 270deg,#547085, #3d4f5d);
}
.page.dark.active {
border: none;
background: #2f3237;
box-shadow: inset 0px 0px 8px rgba(0,0,0, .5), 0px 1px 0px rgba(255,255,255, .1);
}
.page.dark.gradient {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#565b5f), to(#3e4347));
background: -moz-linear-gradient(0% 0% 270deg,#565b5f, #3e4347);
}
<div class="pagination">
first<a href=
"#" class="page gradient">2</a><a href="#" class=
"page gradient">3</a><span class=
"page active">4</span><a href="#" class=
"page gradient">5</a><a href="#" class=
"page gradient">6</a><a href="#" class=
"page gradient">last</a>
</div>

2 DIVs are overlapping with float:right

I am working in HTML and CSS and I find it difficult to rearrange my overlapping elements.
Live example on the jsFiddle
CSS:
#posts {
background: blue;
float: right;
width: 75%;
padding: 5px;
border-radius: 4px;
-webkit-box-shadow: inset 0 0 1px 1px rgba(255, 255, 255, 0.1), 0 2px 10px rgba(0, 0, 0, 0.5);
box-shadow: inset 0 0 1px 1px rgba(255, 255, 255, 0.1), 0 2px 10px rgba(0, 0, 0, 0.5);
}
#login-container {
overflow: clear;
background: white;
width: 280px;
height: 330px;
}
HTML:
<div id="content" class="container">
<div id="posts">
<div id="login-container">
<div id="login">
<h1>Member login</h1>
</div>
</div>
</div>
</div>
These two always overlap to each other when I resize my browsers window.
I wish I can post an image here but it needs 10 reps.
May I ask, where are you closing the #posts div? This might be because #login-container is inside #posts.
Look here:
http://jsfiddle.net/nxyg0xwd/4/
#posts {
float: left;
width: 100%;
margin-left: 288px;
}
You have to left float the content, and create a margin in the size of the login vid.

Class:hover doesn't work on Firefox

I have a little problem with Firefox, this is the html
<html>
<button name="five" data-type="select" class="ui_button ui_button_normal">
<span>Pasta</span>
<div class="ui_button ui_button_normal ui_select_list">
<div class="ui_select_list_item" name="Pasta">Pasta</div>
<div class="ui_select_list_item" name="Carne">Carne</div>
<div class="ui_select_list_item" name="Verdura">Verdura</div>
<div class="ui_select_list_item" name="Pesce">Pesce</div>
<div class="ui_select_list_item" name="Dolce">Dolce</div>
<div class="ui_select_list_item" name="Frutta">Frutta</div>
<div class="ui_select_list_item" name="Caffè">Caffè</div>
</div>
</button>
</html>
and this is the CSS
.ui_select_list
{
margin: 0px !important;
height: auto !important;
padding: 10px;
}
.ui_select_list_item
{
border: 1px solid transparent;
}
.ui_select_list_item:hover
{
border: 1px solid transparent;
background-color: rgba(0, 185, 0, 0.3);
box-shadow: 0 0 2px 1px #000000;
border-radius: 10px;
}
.ui_button
{
background-color: rgba(140, 140, 140, 0.5);
border: 0 solid transparent;
border-radius: 10px 10px 10px 10px;
color: #FFFF00;
font-family: verdana, sans-serif;
font-size: 15px;
height: 32px;
line-height: 30px;
margin: 5px;
position: relative;
text-align: center;
width: 160px;
}
.ui_button_normal
{
box-shadow: 0 0 1px 4px rgba(0, 0, 0, 0.5);
}
.ui_button_normal:hover
{
background-color: rgba(180, 180, 180, 0.5);
box-shadow: 0 0 2px 5px rgba(0, 0, 0, 0.8);
}
Can be found on http://jsfiddle.net/Mak73/3YkSe/
The problem is that, on Google Chrome it works like expeted, when the mouse is over the div.ui_select_list_item the content of the div change with div.ui_select_list_item:hover.
On Firefox the :hover don't work, any idea?
It's not working because you're wrapping a <button> around the divs .. close it after the <span> and the :hover state will work ..
Jsfiddle: http://jsfiddle.net/3YkSe/2/
I suggest you try applying the following element options:
display: none;
display: inline;
I think this will do some better work in Firefox, on focus pop the
menu and display it inline, without block. This is just an idea I've
got for you to try out. Reply back if it works or not! Thanks!

Resources