I have the following code:
<div class="row front-page-img">
<img class="img-responsive" src="http://www.echomountainresort.com/wp-content/uploads/2014/10/echo-mountain-concert_banner_bg.jpg" style="box-shadow: rgba(0,0,0,.2) 3px 5px 5px;">
<div class="front-page-container-search">
<h3>This is the text that I wish could be solid white, but instead it is transparent</h3>
<form>
<div class="input-group">
<input type="text" class="form-control">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
</form>
</div>
</div>
.front-page-img {
margin-right: 0px;
}
.front-page-container-search{
position:absolute;
left: 50px;
right:50px;
width: 200px;
color: white;
text-align: center;
top: 75px;
background-color: rgba(0, 0, 0, 0.6);
border: 1px solid black;
opacity: 0.7;
margin: 0 auto;
}
As you can see here at my jsFiddle my text is not solid white and my input is transparent. Ideally I would like to have solid white text and a solid input. I attempted to use the accepted answer from this older question and tried playing with z-index, but no luck there. Any help is appreciated.
Set your opacity to 1 and wrap the divs correctly. Here is the fiddle.
https://jsfiddle.net/n6qzsttL/
<div class="row front-page-img ng-scope">
<img class="img-responsive" src="http://www.echomountainresort.com/wp-content/uploads/2014/10/echo-mountain-concert_banner_bg.jpg" style="box-shadow: rgba(0,0,0,.2) 3px 5px 5px;">
<div class="front-page-container-search">
<h3>This is the text that I wish could be solid white, but instead it is transparent</h3>
</div>
<form>
<div class="input-group">
<input type="text" class="form-control"> <span class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
</form>
and the CSS
.front-page-img {
margin-right: 0px;
}
.front-page-container-search {
position:absolute;
left: 50px;
right:50px;
width: 200px;
color: white;
text-align: center;
top: 75px;
background-color: rgba(0, 0, 0, 0.6);
border: 1px solid black;
opacity: 1;
margin: 0 auto;
}
There's nothing wrong with your z-indexes. You're setting the opactiy of .front-page-container-search to 0.7. This does what it says on the tin; it renders the element - including everything inside of it - with an opacity of 0.7.
If you don't want the opacity to propagate through the children, don't set it on the parent. Remove this property, and your text, and input, will be solid white.
Currently you are using the opacity for .front-page-container-search as 0.7. Please use 1 instead of 0.7.
.front-page-container-search{
/* Theoretically for IE 8 & 9 (more valid) */
/* ...but not required as filter works too */
/* should come BEFORE filter */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; // IE8
/* This works in IE 8 & 9 too */
/* ... but also 5, 6, 7 */
filter: alpha(opacity=100); // IE 5-7
/* Modern Browsers */
opacity:1;
}
Related
I'm currently facing a slight problem with text on top of a 'glass-morphism' effect that is achieved by the backdrop-filter: blur() property. In some cases, the text on top of the div with the glass effect seems a bit blurred or something. This seems to happen when the text jumps to the next line, due to the variable width.
Side-by-side comparisons: https://imgur.com/a/Sq0Unq7.
As you can see, the difference between the viewport width can be as small as 1 pixel. Removing the backdrop-filter fixes the issue, but I'd like to keep it if it's possible. I've tested this in Chrome and Edge (and Internet Explorer, but that doesn't support the backdrop-filter property). Both came out the same.
This is the code for the 'glass' div:
.glassback {
height: auto;
background: rgba(0, 0, 0, 0.55);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
backdrop-filter: blur( 4px );
-webkit-backdrop-filter: blur( 4px );
border-radius: 10px;
padding: 25px;
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
<div class="col-xl-3 col-lg-3 col-md-6 col-12 glassback">
<h3 class="landingpage">FIND YOUR NEW HOME TODAY.</h3>
<br>
<p class="landingpage">We offer a wide variety of apartments and studios in cities like <b>Eindhoven</b>, <b>Tilburg</b> and <b>Arnhem</b>.</p>
<p class="landingpage">Now the real question is:<br>where do <b>you</b> want to live?</p>
<form action="" method="POST">
<div class="row">
<div class="col-10">
<select name="cityselection" id="cityselection" class="form-control overflow">
<option class="overflow" value="all" selected>Eindhoven, Tilburg, Arnhem, 's-Hertogenbosch...</option>
<option value="Eindhoven">Eindhoven</option>
<option value="Tilburg">Tilburg</option>
<option value="Arnhem">Arnhem</option>
<option value="sHertogenbosch">'s-Hertogenbosch</option>
<option value="Amersfoort">Amersfoort</option>
</select>
</div>
<div class="col-2 searchbutton">
<button type="submit" class="btn btn-danger" name="search"><i class="fas fa-search"></i></button>
</div>
</div>
</form>
</div>
Does anyone have any clue? If you need more info, just ask! :)
It's mainly due to the browser engine, and the blurry fonts effect can vary depending of your browser, div size, and even your browser render interpretation. FYI, this behavior also affects div drawings (like a circle having a border radius 100%). Edges can be blurry also in this case.
In all this mess you have a proper workaround: don't apply the backdrop-filter to the div that contains your text, but create a separate absolute div that has the effect, and place it below your text or content. Here is the fix of your code:
<div class="col-xl-3 col-lg-3 col-md-6 col-12 glassback">
<div class="effect"></div>
<h3 class="landingpage">FIND YOUR NEW HOME TODAY.</h3>
<br>
<p class="landingpage">We offer a wide variety of apartments and studios in cities like <b>Eindhoven</b>, <b>Tilburg</b> and <b>Arnhem</b>.</p>
<p class="landingpage">Now the real question is:<br>where do <b>you</b> want to live?</p>
<form action="" method="POST">
<div class="row">
<div class="col-10">
<select name="cityselection" id="cityselection" class="form-control overflow">
<option class="overflow" value="all" selected>Eindhoven, Tilburg, Arnhem, 's-Hertogenbosch...</option>
<option value="Eindhoven">Eindhoven</option>
<option value="Tilburg">Tilburg</option>
<option value="Arnhem">Arnhem</option>
<option value="sHertogenbosch">'s-Hertogenbosch</option>
<option value="Amersfoort">Amersfoort</option>
</select>
</div>
<div class="col-2 searchbutton">
<button type="submit" class="btn btn-danger" name="search"><i class="fas fa-search"></i></button>
</div>
</div>
</form>
</div>
and the css:
.glassback {
height: auto;
background: rgba(0, 0, 0, 0.55);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
border-radius: 10px;
padding: 25px;
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
position: relative;
}
.effect {
backdrop-filter: blur( 4px );
-webkit-backdrop-filter: blur( 4px );
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
}
And a snippet with a concret example:
body {
background-image: url('https://i.imgur.com/S57AcCZ.png');
background-size: 100%;
background-color: grey;
}
.container {
position: relative;
margin: 20px;
display: flex;
align-items: center;
justify-content: center;
padding: 30px;
color: white;
font-size: 20px;
}
.effect {
backdrop-filter: blur(15px) saturate(100%);
-webkit-backdrop-filter: blur(15px) saturate(100%);
background-color: rgba(39, 39, 39, 0.15);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
}
<div class="container">
<div class="effect"></div>
<div class="content">
here is my sharp text
</div>
</div>
This question already has answers here:
Changing the color of an hr element
(27 answers)
Closed 2 years ago.
I have to use <hr> tag inside form, but I can't change color of it. In usual <div> I can change color for that tag in CSS but when I put it inside <form> - CSS doesn't work and whole properties of <hr> are set default. Someone know why?.
.EDIT
Yes, I use bootstrap.
<div class="col-lg-6">
<div class="box-element" id="form-wrapper">
<form id="form">
<div class="user-info row">
<div class="col-md-6">
<input required class="form-control" type="text"
placeholder="Name...">
</div>
<div class="col-md-6">
<input required class="form-control" type="text"
placeholder="Email...">
</div>
</div>
<h6>
Shopping information:
</h6>
<hr/>
<div class="shopping-info">
</div>
<input type="submit" value="Continue"
class="btn my-btn btn-block">
</form>
</div>
</div>
Set border-color of the <hr> tag.
form hr {
border-color: blue;
}
<form>
This is form with an underline
<hr>
</form>
Can you share your CSS and HTML code with us?
Properties of an hr tags are (or just default properties):
hr {
-moz-border-bottom-colors: none;
-moz-border-image: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
border-color: #EEEEEE -moz-use-text-color #FFFFFF;
border-style: solid none;
border-width: 1px 0;
margin: 18px 0;
}
You can use the border property to style a hr element like this:
/* Red border */
hr.new1 {
border-top: 1px solid red;
}
/* Dashed red border */
hr.new2 {
border-top: 1px dashed red;
}
/* Dotted red border */
hr.new3 {
border-top: 1px dotted red;
}
/* Thick red border */
hr.new4 {
border: 1px solid red;
}
/* Large rounded green border */
hr.new5 {
border: 10px solid green;
border-radius: 5px;
}
For more info about the hr tag please check w3school
I need to finish simple form, but I'm loosing my mind dealing with CSS, etc. Here is a picture that shows what is wrong
As you can see, Label is position like 1px to the left and button is bigger than input. I'v used same input-group-addon with textarea, using this style
.input-group{
width: 100%;
}
.input-group-addon{
width: 220px !important;
}
.textarea-addon{
border-bottom-left-radius: 0px !important;
border-top-right-radius: 4px !important;
border:1px solid #ccc !important;
border-bottom: none !important;
}
And it works perfect, but using it with text input just looks ugly. Here is the code
<div class="col-sm-12">
<span class="input-group-addon textarea-addon">Account numbers</span>
<div class="input-group input-group-sm form-inline panel">
<input type="text" ng-model="model.accountNumber" id ="accountNumber" class="form-control" style="width:80%"> </input>
<input type="button" ng-click="add(accountNumber)" value="Add" class="btn btn" style="width:20%"></input>
</div>
</div>
Hope this will helpful for you, I have put new class to your code
.inputgroup_flex {
display: flex;
align-items: stretch;
border-width: 0;
}
.inputgroup_flex #accountNumber {
height: 36px;
}
https://codepen.io/Thakur92411/pen/QZLqNZ
I have a form maked with Bootstrap, i want to apply styles to button when the input text is focus (for example when focus background to green), how can i do?
Main structure:
<div class="col-md-5"><div class="input-group">
<input id="inputSearch cf" class="form-control" placeholder="Search..." type="text">
<span class="input-group-btn">
<button id="btnSearch" class="btn btn-primary" type="button">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
</div>
</div>
This is my JSFFidle: http://jsfiddle.net/3Q3Le/
Add this style in your site css file:
.form-control:focus {
border-color: #00cf00;
box-shadow: 0 1px 1px rgba(0, 207, 0, 0.075) inset, 0 0 8px rgba(0, 207, 0, 0.6);
outline: 0 none;
}
.form-control:focus + .input-group-btn .btn { background:green }
Click here for demo
Demo Fiddle
Try adding the below to your CSS:
input[id="inputSearch cf"]:focus{
background:green;
}
Try this: http://jsfiddle.net/3Q3Le/1/
#inputSearch:focus {
background-color: green;
color: #fff;
}
#inputSearch:focus + .input-group-btn #btnSearch {
background: red;
}
If you want you can use jQuery.
$("[id='inputSearch cf']").click(function() {
$("#btnSearch").css("backgroundColor","green");
});
Of course before that you should load jQuery library
Here you can find a demo: http://jsfiddle.net/3Q3Le/4/
Can anyone explain why on the 3rd line of the CSS in this JFiddle demo why the div ID of #form_container requires a height in order for the background to show if a float:left is specified at line 14?
I thought floats did not remove objects from the flow of the browser...
<div id="form_container">
<form id="contact_form" action="#" method="get" accept-charset="utf-8">
<p>
<label for="byour_name">Name:</label>
<input type="text" name="byour_name" value="" id="byour_name">
</p>
<p>
<label for="byour_email_address">Email:</label>
<input type="text" name="byour_email_address" value="" id="byour_email_address">
</p>
<p>
<label for="subject">Subject:</label>
<input type="text" name="formsubject" value="" id="form_subject">
</p>
<p>Message:
<br/>
<textarea id="form_messagebox" name="Message" rows="20" cols="25"></textarea>
</p>
<p>
<input id="submitBtn" type="submit" value="Send it!">
</p>
</form>
CSS
#form_container {
width: 300px;
/* height: 300px; Background works with this uncommented if the float is enabled*/
border: 2px red solid;
padding: 0 10px 0 10px;
background-color: red !important;
}
#form_container form {
color: black;
}
#form_container input, p {
margin: 0;
padding 0;
float:left; /* This breaks the background */
display:inline;
}
#form_container label {
width: 200px;
position:relative;
}
#submitBtn {
}
#contact input, textarea {
box-sizing: border-box;
color: rgb(0, 0, 0);
border-radius: 5px;
box-shadow: rgba(0, 0, 0, 0.6) 0px 1px 4px 0px;
background-color: rgb(221, 220, 219);
font: normal normal normal 16px/1.3em'open sans', sans-serif;
border: 0px solid rgb(192, 185, 181);
}
#form_messagebox {
height: 150px;
width: 200px;
}
here is fiddle of your que see this
http://jsfiddle.net/jkkheni/eJS6b/3/
added a css class of clear
.clear{ clear:both; height:0px; width:0px; display:table; content:"";}
and added a div in your html
<div class="clear"></div>
before closing div with id form_container
when you use float always clear all float.
or you can also use overflow:hidden in div with form_container id
float removes height of the element if it is not specified.
Try:
#form_container{
overflow:hidden;
}
DEMO here.
OR
clear floats after finishing form:
<div class="clr"></div>
.clr{clear:both;}
DEMO here.