Removing single pixel space around input slider - html

Can someone help me figure out why there's a single pixel space between the border of the input range and the top and right edge of the thumb slider? I don't recall this being here before and I can't figure out what is causing it.
#media screen and (min-width:720px) {
.financecalc {
margin-bottom: 0;
width: 300px;
}
.financetext {
width: calc(100% - 330px);
}
}
#media screen and (min-width:960px) {
.financecalc {
width: 400px;
}
.financetext {
width: calc(100% - 430px);
}
}
.paycalc {
background-color: white;
border: 2px solid #b2221b;
border-radius: 8px;
box-shadow: 0 3px 5px 1px black;
padding: 10px;
text-align: center;
width: calc(100% - 24px);
}
.paycalc label {
display: block;
margin-bottom: 4px;
}
.paycalc input[type=range] {
-webkit-appearance: none;
background: #f0f0f0;
border: 2px solid #b2221b;
border-radius: 4px;
display: block;
height: 16px;
opacity: 0.9;
outline: none;
padding: 0;
width: calc(100% - 4px);
}
.paycalc input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 16px;
background: #b2221b;
cursor: pointer;
}
.paycalc input[type=range]::-moz-range-thumb {
width: 20px;
height: 16px;
background: #b2221b;
cursor: pointer;
}
.calcSlider {
margin-bottom: 0;
width: calc(100% - 100px);
}
#interestSlider {
direction: rtl;
}
.calcBox,
.interestBox,
.paymentBox {
background-color: #555;
border: 3px inset #909090;
border-radius: 2px;
color: white;
padding: 6px;
}
.calcBox {
margin-bottom: 0;
width: 62px;
}
.interestBox {
width: 100%;
}
.paymentBox {
width: calc(100% - 18px);
}
.calcBox div,
.paymentBox div {
color: inherit;
margin: 0;
}
.calcBox div:first-of-type,
.paymentBox div:first-of-type {
font-size: 12px;
width: 12px;
}
.calcBox div:last-of-type,
.paymentBox div:last-of-type {
font-size: 18px;
width: calc(100% - 14px);
}
<div id="calculator" class="financecalc">
<form id="myForm" class="paycalc">
<div class="calcSlider">
<label for="downPaymentSlider">Down Payment</label>
<input id="downPaymentSlider" name="downPaymentSlider" type="range" value="500" min="250" max="5000" step="50">
</div>
</form>
</div>

The white line can appear at various zoom levels depending on how the system is mapping CSS pixels to screen pixels (there being several screen pixels to a CSS pixel on many higher def screens nowadays).
It's a bit like a rounding error, a screen pixel can get 'left behind' in the calculations.
As your thumb and your border are the same color here's a slightly unpleasant hack, but it overcomes the problem visually.
This snippet makes the height of the thumb equal to the height of the input element plus its top and bottom borders - this gives the system lots of wiggle room when it's dropping or including a screen pixel and the user won't see bits of white.
#media screen and (min-width:720px) {
.financecalc {
margin-bottom: 0;
width: 300px;
}
.financetext {
width: calc(100% - 330px);
}
}
#media screen and (min-width:960px) {
.financecalc {
width: 400px;
}
.financetext {
width: calc(100% - 430px);
}
}
.paycalc {
background-color: white;
border: 2px solid #b2221b;
border-radius: 8px;
box-shadow: 0 3px 5px 1px black;
padding: 10px;
text-align: center;
width: calc(100% - 24px);
}
.paycalc label {
display: block;
margin-bottom: 4px;
}
.paycalc input[type=range] {
-webkit-appearance: none;
background: #f0f0f0;
border: 2px solid #b2221b;
border-radius: 4px;
display: block;
height: 16px;
opacity: 0.9;
outline: none;
padding: 0;
width: calc(100% - 4px);
}
.paycalc input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 16px;
height: 20px;
/* 16px + 2x2px */
background: #b2221b;
cursor: pointer;
}
.paycalc input[type=range]::-moz-range-thumb {
width: 20px;
height: 20px;
background: #b2221b;
cursor: pointer;
}
.calcSlider {
margin-bottom: 0;
width: calc(100% - 100px);
}
#interestSlider {
direction: rtl;
}
.calcBox,
.interestBox,
.paymentBox {
background-color: #555;
border: 3px inset #909090;
border-radius: 2px;
color: white;
padding: 6px;
}
.calcBox {
margin-bottom: 0;
width: 62px;
}
.interestBox {
width: 100%;
}
.paymentBox {
width: calc(100% - 18px);
}
.calcBox div,
.paymentBox div {
color: inherit;
margin: 0;
}
.calcBox div:first-of-type,
.paymentBox div:first-of-type {
font-size: 12px;
width: 12px;
}
.calcBox div:last-of-type,
.paymentBox div:last-of-type {
font-size: 18px;
width: calc(100% - 14px);
}
<div id="calculator" class="financecalc">
<form id="myForm" class="paycalc">
<div class="calcSlider">
<label for="downPaymentSlider">Down Payment</label>
<input id="downPaymentSlider" name="downPaymentSlider" type="range" value="500" min="250" max="5000" step="50">
</div>
</form>
</div>

Related

In Dual Slider HTML component, click inside first element is not recognized in Internet Explorer

I am trying to build a Dual Step Slider using HTML and CSS alone without any JQuery. It is working fine in Chrome and Mozilla, But in IE11, it is not registering the click inside first input element.
I designed the slider by using position:absolute and made two html input sliders on top of each other. In IE, i could click and drag on Second Input Elemenr only.
.slider {
-webkit-appearance: none;
width: 100%;
//height: 10px;
position: absolute;
//background: #f3f3f3;
outline: none;
border-radius: 8px;
}
.slider input {
pointer-events: none;
position: absolute;
overflow: hidden;
left: 25%;
top: 15px;
width: 50%;
outline: none;
height: 18px;
margin: 0;
padding: 0;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 8px;
background: #E6E6E6;
border: none;
border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
//border: none;
height: 20px;
width: 20px;
border-radius: 50%;
background: white;
border: 1px solid #3972D6;
margin-top: -4px;
cursor: pointer;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #e6e6e6;
border: 2px solid #cdcdcd;
pointer-events: all;
position: relative;
z-index: 1;
outline: 0;
}
.slider::-moz-range-thumb {
width: 20px;
height: 20px;
background: #ea4550;
pointer-events: all;
position: relative;
z-index: 10;
-moz-appearance: none;
}
.slider input::-moz-range-track {
position: relative;
z-index: -1;
border: 0;
}
.slider input:last-of-type::-moz-range-track {
-moz-appearance: none;
background: none transparent;
border: 0;
}
.slider input[type="range"]::-moz-focus-outer {
border: 0;
}
.flex-next {
display: flex;
justify-content: flex-start;
}
.dual-slider-container {
position: relative;
width: 100%;
}
.dual-slider-text-left {
position: relative;
bottom: 12px;
right: 8px;
.text-style {
color: #303030;
font-size: 20px;
font-weight: 600;
text-align: right;
}
.text2 {
text-align: right;
font-size: 14px;
}
}
.dual-slider-text-right {
position: relative;
bottom: 12px;
left: 8px;
.text-style {
color: #303030;
font-size: 20px;
font-weight: 600;
text-align: left;
}
.text2 {
text-align: left;
font-size: 14px;
}
}
.pointer {
cursor: pointer;
}
//Internet Explorer Support
input[type=range]::-ms-track {
width: 100%;
height: 8px;
/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
background: transparent;
/*leave room for the larger thumb to overflow with a transparent border */
border-color: transparent;
border-width: 6px 0;
/*remove default tick marks*/
color: transparent;
}
#lower::-ms-fill-lower {
background: #E6E6E6;
border-radius: 10px;
}
#lower::-ms-fill-upper {
background: #E6E6E6;
border-radius: 10px;
}
#higher::-ms-fill-lower {
background: transparent;
border-radius: 10px;
}
#higher::-ms-fill-upper {
background: transparent;
border-radius: 10px;
}
input[type=range]::-ms-thumb {
//border: none;
height: 18px;
width: 18px;
border-radius: 50%;
background: white;
border: 1px solid #3972D6;
//cursor: hand;
}
input[type=range]::-ms-tooltip {
display: none;
}
<div style="padding:8px" class="col-12 row m-0">
<div class="dual-slider-text-left col-2 p-0">
<div class="text-style">
{{minValue}}
</div>
<div class="text2">{{minValueText}}</div>
</div>
<div class="col-8 p-0">
<div class="dual-slider-container">
<input (click)="getSliderOneValue($event)" type="range" min="{{minValue}}" max="{{maxValue}}" step="1"
value="{{sliderOneValue}}"
class="slider" [disabled]="disabled" [ngClass]="{'pointer' : !disabled}"
id="lower">
</div>
<div class="dual-slider-container">
<input (click)="getSliderTwoValue($event)" type="range" min="{{minValue}}" max="{{maxValue}}" step="1"
value="{{sliderTwoValue}}"
class="slider" [disabled]="disabled" [ngClass]="{'pointer' : !disabled}"
id="higher">
</div>
</div>
<div class="dual-slider-text-right col-2 p-0">
<div class="text-style">{{maxValue}}</div>
<div class="text2">{{maxValueText}}</div>
</div>
</div>
It seems that you can only reach the second slider if they're lapped in IE. You could use two slides side by side as a workaround. I make a demo and you could refer to it.
body {
min-height: 100px;
}
div {
display: flex;
}
input {
flex: 1 0 0;
min-width: 0;
padding: 0;
}
input::-webkit-slider-thumb {
margin: 0;
padding: 0;
}
output {
display: block;
text-align: center;
margin-top: 3px;
color: gray;
}
<div>
<input id="a" type="range" min="0" max="10" value="0" />
<input id="b" type="range" min="11" max="20" value="20" />
</div>
<output></output>

Stop the text moving down on hover

I have a text in the middle of the div block with a font size 80px. When I hover on the div block, it will change the border size from 1px to 5px with a blue color but the text will moves down.
.calendar-content {
width: 81%;
display: block;
padding: 0;
background: #fff;
float: left;
position: relative;
margin-bottom: 150px;
}
.calendarday-container {
width: 139px;
height: 139px;
float: left;
position: relative;
margin-top: -1px;
margin-left: -1px;
border: 1px solid #ccc;
}
.calendarday-add .calendarday-number {
display: inline-block;
width: 100%;
font-size: 80px;
color: #f1f1f1;
margin: 12px 0px;
text-align: center;
}
.calendarday-number:hover {
margin: 12px 2px;
}
.calendarday-container:hover {
border: 5px solid #2e7ad1;
}
.add-day-ico {
display: none;
width: 21px;
height: 21px;
margin: 22px 0px;
float: right;
}
.calendarday-container:hover .add-day-ico {
display: block;
margin: 22px 0px;
}
<div class="calendarday-container" data-day="0" data-dropable="true">
<a href="/autoresponder/create_day.php?day=0" data-action="click" class="calendarday-add">
<span class="calendarday-number">0</span>
<img src="http://www.clker.com/cliparts/u/F/K/J/M/A/add-button-md.png" sytle="height: 21px; width: 21px;" align="right" style="margin-top: 3px;" class="add-day-ico">
</a>
</div>
Jsfiddle: http://jsfiddle.net/f0k6r9nb/
I have tried to change the margin in the calendarday-container:hover .add-day-ico but it didn't help to resolve the issue.
Can you please show me an example how I can stop the text moving down on hover?
Thank you.
Changing the width of the border from 1px to 5px and recalculating the inner parts is not a practical solution. You could use an additional element, which has 5px of transparent border and change it to 5px of colored border on hover.
Another simple solution would be to use outline instead, as it doesn't add to the elements dimensions:
.calendar-content {
width: 81%;
display: block;
padding: 0;
background: #fff;
float: left;
position: relative;
margin-bottom: 150px;
}
.calendarday-container {
width: 139px;
height: 139px;
float: left;
position: relative;
margin-top: -1px;
margin-left: -1px;
border: 1px solid #ccc;
}
.calendarday-container:hover {
outline: 5px solid #2e7ad1;
}
.calendarday-add .calendarday-number {
display: inline-block;
width: 100%;
font-size: 80px;
color: #f1f1f1;
margin: 12px 0px;
text-align: center;
}
.add-day-ico {
opacity: 0;
width: 21px;
height: 21px;
position: absolute;
bottom: 0;
right: 0;
}
.calendarday-container:hover img {
opacity: 1;
}
<div class="calendarday-container" data-day="0" data-dropable="true">
<a href="/autoresponder/create_day.php?day=0" data-action="click" class="calendarday-add">
<span class="calendarday-number">0</span>
<img src="http://www.clker.com/cliparts/u/F/K/J/M/A/add-button-md.png" class="add-day-ico">
</a>
</div>
A typical approach to showing a border on hover is to have the non-hover state be transparent or a color that matches the background along with the width matching that of the border when hovered.
In this case, there's an existing 1px border. Here, I would change the gray border blue, then use an inset box-shadow to add the additional 4px of the border.
Note: I also removed some margin for .calendarday-number on hover so the number does not shift.
.calendar-content {
width: 81%;
display: block;
padding: 0;
background: #fff;
float: left;
position: relative;
margin-bottom: 150px;
}
.calendarday-container {
width: 139px;
height: 139px;
float: left;
position: relative;
margin-top: -1px;
margin-left: -1px;
border: 1px solid #ccc;
}
.calendarday-add .calendarday-number {
display: inline-block;
width: 100%;
font-size: 80px;
color: #f1f1f1;
margin: 12px 0px;
text-align: center;
}
/*
.calendarday-number:hover {
margin: 12px 2px;
}
*/
.calendarday-container:hover {
border-color: #2e7ad1;
box-shadow: inset 0 0 0 4px #2e7ad1;
}
.add-day-ico {
display: none;
width: 21px;
height: 21px;
margin: 22px 0px;
float: right;
}
.calendarday-container:hover .add-day-ico {
display: block;
margin: 22px 0px;
}
<div class="calendarday-container" data-day="0" data-dropable="true">
<a href="/autoresponder/create_day.php?day=0" data-action="click" class="calendarday-add">
<span class="calendarday-number">0</span>
<img src="http://www.clker.com/cliparts/u/F/K/J/M/A/add-button-md.png" sytle="height: 21px; width: 21px;" align="right" style="margin-top: 3px;" class="add-day-ico">
</a>
</div>
Add this:
.calendarday-container {
border: 5px solid transparent;
outline: 1px solid #ccc;
outline: none;
}
.calendarday-container:hover {
outline: none;
}
Remove this:
.calendarday-number:hover {
margin: 12px 2px;
}
You can use a pseudo element like this. I also removed lot of unnecessary css that was fighting each other
* { margin: 0; padding: 0; box-sizing: border-box; }
body { margin: 5%; }
/* Normal */
.calendarday-container {
width: 150px; height: 150px;
position: relative;
display: flex; align-items: center; justify-content: center;
}
.calendarday-container:after {
content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
border: 1px solid #ccc; z-index: -1;
}
.caldndarday-add { text-decoration: none; }
.calendarday-number { font-size: 80px; color: #ccc; }
.add-day-ico { width: 24px; height: 24px; position: absolute; bottom: -8px; right: -8px; }
/* Hover FX */
.calendarday-container:hover:after { border: 10px solid navy; }
.calendarday-container:hover .calendarday-number { color: navy; }
<div class="calendarday-container" data-day="0" data-dropable="true">
<a class="caldndarday-add" href="/autoresponder/create_day.php?day=0" data-action="click">
<span class="calendarday-number">0</span>
<img class="add-day-ico" src="http://www.clker.com/cliparts/u/F/K/J/M/A/add-button-md.png">
</a>
</div>
The text was moving down because, There was increase in border-width from 1px to 5px while hover.
You can either maintain a outline around the box using outline property, and keeping the border: 5px solid transparent to border: 5px solid #2e7ad1 while hovering.
I've created a working fiddle for you, for better understanding: Link to Jsfiddle

Different result for different browser with CSS

I have different results for different browsers in the following code:
.flexsearch--wrapper {
height: auto;
width: 50%;
max-width: 700px;
min-width: 100px;
top: 20px;
overflow: hidden;
background: transparent;
margin: 1px;
position: absolute;
}
.flexsearch--form {
overflow: hidden;
position: relative;
}
.flexsearch--form {
padding: 0 66px 0 0;
/* Right padding for submit button width */
overflow: hidden;
}
.flexsearch--input {
width: 100%;
}
.flexsearch {
padding: 0 25px 0 200px;
/* Padding for other horizontal elements */
}
.flexsearch--input {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 30px;
padding: 0 46px 0 10px;
border-color: #888;
border-radius: 3px;
/* (height/2) + border-width */
border-style: solid;
border-width: 2px;
/*margin-top: 10px;*/
color: #333;
font-family: 'Helvetica', sans-serif;
font-size: 16px;
-webkit-appearance: none;
-moz-appearance: none;
}
.flexsearch--submit {
position: absolute;
right: 0;
top: 0;
display: block;
width: 32px;
height: 32px;
padding: 0;
border: none;
margin-top: 4px;
/* margin-top + border-width */
margin-right: 5px;
/* border-width */
background: transparent;
color: #888;
font-family: 'Helvetica', sans-serif;
font-size: 30px;
line-height: 30px;
-webkit-appearance: none;
-moz-appearance: none;
}
.flexsearch--input:focus {
outline: none;
border-color: #333;
}
.flexsearch--input:focus.flexsearch--submit {
color: #333;
}
.flexsearch--submit:hover {
color: #333;
cursor: pointer;
}
/* UPLOAD ICON IMAGE */
#uploadIcon {
/*width: 10%;
height: 100%;*/
padding-top: 10px;
min-width: 80px;
max-width: 80px;
position: absolute;
margin: 0 1% 0 77%;
/* left : 77%;*/
top: -3px;
}
/* SIGN UP / SIGN IN*/
.Signin {
position: fixed;
/*left: 85%;*/
margin-left: 86%;
top: 24px;
/*border : 1.5px solid grey;*/
padding: 3px;
margin-right: 2px;
float: right;
}
/*#Signup {
position: absolute;
left: 93%;
top: 20px;
border : 1.5px solid grey;
padding: 3px;
margin-right: 3px;
}
*/
<div class="flexsearch">
<div class="flexsearch--wrapper">
<form class="flexsearch--form" action="#" method="post">
<div class="flexsearch--input-wrapper">
<input class="flexsearch--input" type="search" placeholder="search">
</div>
<input class="flexsearch--submit" type="submit" value="➜" />
</form>
</div>
</div>
<img src="upload_icon.png" id = "uploadIcon">
Sign In/Sign Up
<!-- Sign Up -->
The problem is that arrow and the Sign In and Sign Up with Firefox works perfectly :
But with Chrome or Safari it doesn't:
Is the problem from my code? or do I need to add some customized code for each browser. And if yes, how can that be done? Can it be done with -webkit or -moz Because I tried this, but it didn't work. Probably, I haven't written it well.

css adjusting vertical positioning of fixed element

I'm having troubles with positioning the textbox for my chat. I can only make it look good for one specific resolution. On other screen sizes it just looks terrible. How can I adjust the position of the textbox for all resolutions (>1360px) to fit in the little darkgrey area on the bottom. When I try to adjust it for one resolution it won't look good on the other resolutions.
https://jsfiddle.net/4pvfwz11/1/
<div class="chatdiv hidden-xs hidden-sm col-lg-2 col-md-3 pull-right" data-spy="affix">
<div class="scrollbar" id="style-2">
<div class="force-overflow"></div>
<ol class="chat">
<div id="fullchat">
<li class="bot"><div class="avatar"><img src="'+msg.avatar+'" draggable="false"/></div><div class="msg"><div class="name">Username</div><p>The chat text should come here..........</p><time><i class="fa fa-clock-o" aria-hidden="true"></i>19:00</time></div></li>
</div>
<div class="chat_error"></div>
</ol>
</div>
<div class="toggle-sound"></div>
<input class="textarea" id="chat_textbox" type="text" placeholder="Enter message here"/>
<style type="text/css">
div.chat_error {
color: #e20f0f;
padding-left: 10px;
padding-top: 1rem;
}
.chatdiv
{
position: fixed;
left: 40px;
background-color: #101010;
height: 90vh;
}
.chatdiv .name{
top: 3px;
left: 110px;
font-size: 10px;
font-weight: bold;
color: rgba(256,256,256,0.80);
cursor: default;
}
/* M E S S A G E S */
.chat {
list-style: none;
background: none;
margin: 0;
padding: 0 0 50px 0;
margin-top: 60px;
margin-bottom: 10px;
}
.chat li {
padding: 0.5rem;
overflow: hidden;
display: flex;
}
.chat .avatar img {
margin-top: 15px;
width: 40px;
height: 40px;
border-radius: 100%;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
-ms-border-radius: 100%;
background-color: rgba(255,255,255,0.9);
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.other .msg {
order: 1;
border-top-left-radius: 0px;
box-shadow: -1px 2px 0px #187006;
margin-left: 10px;
background-color: #27af0c;
}
.self {
justify-content: flex-end;
align-items: flex-end;
}
.self .msg {
order: 1;
border-bottom-right-radius: 0px;
background-color: #0a95db;
box-shadow: 1px 2px 0px #055f8c;
margin-left: 10px;
}
.bot .msg {
order: 1;
border-bottom-right-radius: 0px;
background-color: #a50808;
box-shadow: 1px 2px 0px #6b0606;
margin-left: 10px;
}
.msg {
background: white;
min-width: 50px;
padding: 10px;
border-radius: 2px;
box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.07);
}
.msg p {
font-size: 15px;
margin: 0 0 0.2rem 0;
color: white;
}
.msg time {
font-size: 10px;
color: #ccc;
margin-top: 3px;
float: right;
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
/* T Y P E */
input.textarea {
position: absolute;
width: 89%;
height: 50px;
left: 15px;
bottom: 3vh;
background: white;
border: none;
outline: none;
padding-left: 10px;
padding-right: 10px;
color: #666;
font-weight: 400;
}
div.toggle-sound {
position: fixed;
bottom: 13vh;
left: 65px;
font-weight: bold;
font-size: 20px;
}
.scrollbar
{
float: left;
height: 80vh;
background-color: #232323;
overflow-y: scroll;
margin-bottom: 25px;
width: 100%;
}
.force-overflow
{
min-height: 90vh;
}
#style-2::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #232323;
}
#style-2::-webkit-scrollbar
{
width: 12px;
background-color: #232323;
}
#style-2::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #E20F0F;
}
</style>
If you want different CSS for different screen sizes you can use something called media queries. I don't know exactly what rules you want to change for different screen sizes, but let's do a quick example. Let's say you want to make the background color of the textbox red on screens with a width less than or equal to 900px. This can be done with the following media query:
#media (max-width: 900px) {
input.textarea {
background-color: red;
}
}
So what you can do is just to figure out what CSS changes you want to do on different screen sizes, and then make media queries for all of them. You can read more about media queries here.

Fixing opacity of content inside div

I have a div that has a background image but has 50% opacity.
Now I have a div that is child and I want what every the content it has to have 100% opacity. You can see in the snipplet headings and textbox and button has less opacity.
Can anyone help how to fix this thing? I tried to apply opacity 100% to child but it didn't work.
/* CSS to be fixed*/
#home_div
{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/Shoppers_on_Dundas%2C_near_Yonge.jpg/1200px-Shoppers_on_Dundas%2C_near_Yonge.jpg");
opacity: 0.5;
filter: alpha(opacity=50);
/*background-color: #0050A0;*/
background-color: lightgrey;
padding-top: 200px;
color: white;
padding-bottom: 200px;
height: 100%;
}
#home_div_content
{
opacity: 1.0;
filter: alpha(opacity=100);
text-align: center;
}
#header
{
height: 70px;
border-bottom: 4px solid lightgrey;
}
#header_content
{
margin-top: 10px;
margin-left: 80px;
}
.brandmark
{
margin-top: -20px;
}
.link_to a
{
color: #0050A0 !important;
}
.featured_div
{
display: none;
}
.featured_close_anchor, .featured_anchor_close
{
text-align: center;
}
#heading, #tag_line
{
top: -300px;
position:relative;
color: #0050A0;
}
#search
{
border-radius: 0 !important;
border-color: #0050A0 !important;
width: 60%;
height: 35px;
padding: 8px 15px;
color: #0050A0; /* change color of text to be typed inside search box */
font-size: 13px;
line-height: 20px;
background-color: transparent;
border: 1px solid #ccc;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-custom {
color: #FFFFFF;
background-color: #0050A0; /* change button color */
border-radius: 0!important; /* button border radius */
padding: 5px 11px; /* Button size change*/
margin-top: -3.5px;
border-top: 2px solid #0050A0;
border-bottom: 3px solid #0050A0;
margin-left: -3px;
}
.btn-custom:hover{
background-color:#9AC94B; /* change button color on hover */
border-radius: 0!important;
}
.left_categories
{
padding-top: 5px;
padding-bottom: 5px;
margin-bottom: 1px;
border-left: 4px solid #0050A0;
}
.left_categories:hover
{
border-top: 1px solid lightgrey;
border-bottom: 1px solid lightgrey;
border-left: 4px solid #E5002B;
}
.active_category
{
background-color: #0050A0;
color: white !important;
border-left: 4px solid #E5002B;
}
.search_section
{
margin-top: 30px;
}
a
{
text-decoration: none !important;
}
.flash_nav
{
height: 90px;
border: 0 !important;
background-color: #283442;
}
.gradient
{
background: -moz-linear-gradient(left, white 0%, white 45%, #12A8E0 85%, #0050A0 100%);
}
.flash_navbar a
{
color: black !important;
}
.search_form
{
width: 70%;
}
.nav_form
{
border-radius: 0;
margin-top: 27px;
}
#searchBar
{
border-color: #0050A0;
}
#searchButton
{
background-color: #0050A0;
color: white;
border: none;
}
<div id="home_div">
<div class="container" id="home_div_content">
<h1 id="heading">Find your product!</h1>
<h4 id="tag_line">Search what you are looking for.</h4>
<form method="GET" action="/product/search">
<input type="text" name="product" id="search" placeholder="Enter product name" class="searchTextBox" />
<button type="submit" id="quick-search" class="btn btn-custom"><span class="glyphicon glyphicon-search custom-glyph-color"></span></button>
</form>
<br />
view <i class="fa fa-chevron-down"></i> featuring
</div>
</div>
FIDDLE
An opacity rule will always affect child/descendant elements since they are part of the parent, and the rule says the parent should be 50% opacity.
To get round this, use a pseudo element and give that reduced opacity rather than the parent.
HTML
<div id='outer'>
<div id='inner'></div>
</div>
CSS
#outer { width: 200px; height: 200px; position: relative; padding: 2em; }
#outer::before { content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: red; opacity: .5; z-index: -1; }
#inner { width: 100%; height: 100%; background: blue; }
Fiddle.