I want to place a search button in the middle of an image. But my button ended up at the bottom and outside of the image.
You can see live on www.emeupci.com
Here is my html code:
<div class="container-fluid headerimage">
<div class="col-md-12">
<img class="img-fluid" src="https://emeupci.com/static/users/img/map.png" alt="map" style="width: 100%;">
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn dropdown-toggle"
style=" border: 26px solid #f9f9f9;
cursor: pointer;
font-weight: bold; background-color: #447193;
color: white; padding: 8px; border-radius: 0px;
font-size: 16px;);">Search for a church</button>
<div id="myDropdown" class="dropdown-content">
<input type="text" placeholder="Search.." id="myInput" onkeyup="filterFunction()">
</div>
</div>
</div>
</div>
If you make your map a background image instead of an img element you can overlay your button on top of the image using this layout. The parent div needs to be relatively positioned and the button needs to be absolutely positioned within the parent div.
<div class="parent">
<div class="child">
button go here
</div>
</div>
.parent {
position: relative;
background: url("Images/") center no-repeat; /* <-- path to your map image here*/
background-size: cover;
width: 300px;
height: 500px;
}
.child { /*This class styles your button or your buttons container*/
position: absolute;
margin: 0 auto;
left: 0;
right: 0;
background-color: #abcf66;
bottom: 40px; /* adjust this to your liking*/
width: 80px;
height: 60px;
}
Related
This is my sample output, as you can see here that the image is half.
The second photo provided is the output i'm trying to achieve.
I don't know what seems to be the problem here, but when i remove the class, "carousel-inner" the image output is complete, but when i put it back, it shows only half image.
this is my html code and i'm using bootstrap 4
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col-4">
<div class="customer-card">
<div class="customer-img">
<img src="assets/img/user-img/john.png" alt="customer image" class="">
</div>
<div class="customer-txt-area">
<p class="john">"With Finger Food, my birthday party was a real blast! Super finger food!"</p>
<h4><b>John Esacada</b></h4>
<small>Sydney</small>
</div>
</div>
</div>
</div>
</div>
</div>
.customer-card-parent{
margin-top: 41px;
width: 100%;
max-width: 964px;
margin-left: auto;
margin-right: auto;
}
.customer-card{
width: 100%;
max-width: 290px;
padding: 39px 0px 35px 0px;
border-radius: 5px;
background: #fff;
}
.customer-img{
position:absolute;
top: -55px;
left: 0;
right: 0;
width: 100%;
max-width: 100px;
height: 100px;
border-radius: 100%;
overflow: hidden;
margin-left: auto;
margin-right: auto;
border: 11px solid #fff;
background-color: #cecece;
}
.customer-img img{
width: 100%;
height: auto;
position: relative;
top: 21px;
transform: scale(1.4, 1.3);
}
.customer-txt-area .john{
font-size: 18px;
color: #696969;
margin: 0px;
padding-top: 40px;
padding-left: 15px;
padding-right: 18px;
line-height: 23px;
font-family: "MyriadPro";
}
.customer-img
{
position:absolute;
top: -55px;
left: 0;
right: 0;
width: 100%;
max-width: 100px;
height: 100px;
border-radius: 100%;
overflow: hidden;
margin-left: auto;
margin-right: auto;
border: 11px solid #fff;
background-color: #cecece;
}
you have to remove "overflow: hidden;" from the above code.
Just remove overflow: hidden; from the parent element, which is ".customer-img" in your case and remember to add padding of half the size of the image to ".customer-card" parent element .
.customer-img{
position:absolute;
top: -55px;
left: 0;
right: 0;
width: 100%;
top:-55px is pushing the image out of the card and since abolute position is used, height of card doesn't consider image height so use min-height or height for card.
.customer-card{
width: 100%;
min-height:300px;
max-width: 290px;
padding: 39px 0px 35px 0px;
border-radius: 5px;
background: #fff;
}
Try this solution
Add here
<div class="row">
Extra style
<div class="row" style="margin-top: 50px">
Just now, i managed to somehow "solved" the issue here without changing any css. I just added some classes to my carousel-inner.
as you can see in this photo, i added border class to my carousel-inner class in order to see the actual "height" and "width" of my div and it shows like this.
<div class="carousel-inner border ">
<div class="carousel-item active">
<div class="row">
<div class="col-4">
<div class="customer-card">
<div class="customer-img">
<img src="assets/img/user-img/john.png" alt="customer image" class="">
</div>
<div class="customer-txt-area">
<p class="john">"With Finger Food, my birthday party was a real blast! Super finger food!"</p>
<h4><b>John Esacada</b></h4>
<small>Sydney</small>
</div>
</div>
</div>
</div>
</div>
</div>
So, i tried adding some classes to my carousel-inner
<div class="carousel-inner border d-flex justify-content-center align-items-center">
<div class="carousel-item active">
<div class="row">
<div class="col-4">
<div class="customer-card">
<div class="customer-img">
<img src="assets/img/user-img/john.png" alt="customer image" class="">
</div>
<div class="customer-txt-area">
<p class="john">"With Finger Food, my birthday party was a real blast! Super finger food!"</p>
<h4><b>John Esacada</b></h4>
<small>Sydney</small>
</div>
</div>
</div>
</div>
</div>
</div>
and now it shows something like this.
I am trying to blur just the image of the background, but it seems that the result that I am getting is blurring the whole div
My code is the following:
.profile-div {
background-image: url("http://2.bp.blogspot.com/_QtDFVR44S_Q/TTu95-aiCqI/AAAAAAAAA-k/jP65Ns2H-f0/s1600/camaleon2.jpg");
width: 100%;
height: 12em;
}
.img-profile {
height: 8em;
width: 8em;
border: 3px solid black;
margin-top: 2em;
margin-bottom: 2em;
}
<div class="profile-div scale-image img-blur">
<div class="form-group">
<input style="display: none" type="file" accept=".png,.jpg" (change)="uploadProfilePicture($event)" #fileInput />
<img *ngIf="imageURL" src="{{auxAuth.photoURL}}" class="pointer rounded-circle img-profile" (click)="fileInput.click()">
</div>
</div>
What I expected was to blur the img of the div background, but it is also blurring the inside img. How could I change that?
I show my current result:
Move the background image to a separate div, and wrap them both with a container:
HTML:
<div class="container-div">
<div class="profile-div scale-image img-blur"></div>
<div class="form-group">
<input style="display: none" type="file" accept=".png,.jpg" (change)="uploadProfilePicture($event)" #fileInput />
<img *ngIf="imageURL" src="{{auxAuth.photoURL}}" class="pointer rounded-circle img-profile" (click)="fileInput.click()">
</div>
</div>
CSS:
.profile-div, .container-div {
width: 100%;
height: 12em;
}
.profile-div {
//example blur
filter: blur(8px);
-webkit-filter: blur(8px);
}
.img-profile {
position: absolute;
top: 2em;
bottom: 2em;
height: 8em;
width: 8em;
border: 3px solid black;
}
I have tried to make a tag that completely covers a div element and when clicked, the button element would disappear.
HTML:
I have tried setting height and width to 100%, but this does not fill the area entirely... how do I fix this?
#startstorybutton {
height: 100%;
width: 100%;
position: absolute;
top: 7.5vw;
right: 20vw;
z-index: 10;
background-color: #f4511e;
color: white;
Font-size: 50px;
font-style: italic;
transition: all 0.6s;
cursor: url(cursors/select.PNG), pointer;
}
#story {
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Three_little_pigs_%28geograph_4633727%29.jpg/1200px-Three_little_pigs_%28geograph_4633727%29.jpg");
background-size: 100%;
height: 40%;
width: 80%;
margin: 0 auto;
}
<div id="story">
<div>
<p id="storytitle">The Three Little Pigs</p>
<div>
<p id="storybox"></p>
</div>
<div id="storybuttonsection">
<button type="button" id="backbutton"><span>Go back</span></button>
<p id="pagenumber">121212</p><button id="continuebutton"><span>Continue</span></button>
</div>
</div>
<button type="button" id="startstorybutton">Start the story!</button>
</div>
You have to position the button element on top of the "hidden element", if you set the main element position to relative you can then position the child element absolute over it (top: 0; right: 0) with the height and width to 100%.
For hide the button, the easy way is to add a listener event to the button and then hide it (or remove it) with javascript.
#startstorybutton {
height: 100%;
width: 100%;
position: absolute;
top: 0;
right: 0;
z-index: 10;
background-color: #f4511e;
color: white;
Font-size: 50px;
font-style: italic;
transition: all 0.6s;
cursor: url(cursors/select.PNG), pointer;
}
#story {
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Three_little_pigs_%28geograph_4633727%29.jpg/1200px-Three_little_pigs_%28geograph_4633727%29.jpg");
background-size: 100%;
height: 40%;
width: 80%;
margin: 0 auto;
position: relative;
}
<div id="story">
<div>
<p id="storytitle">The Three Little Pigs</p>
<div>
<p id="storybox"></p>
</div>
<div id="storybuttonsection">
<button type="button" id="backbutton"><span>Go back</span></button>
<p id="pagenumber">121212</p><button id="continuebutton"><span>Continue</span></button>
</div>
</div>
<button type="button" id="startstorybutton" onclick="this.style.display = 'none'">Start the story!</button>
</div>
I am not very sure of your HTML structure. But as you described your problem I have created an example for you.
You need t make changes in your HTML to make it simple and straightforward.
The story div contains the button, which will be absolutely positioned to fit the entire div.
I have thrown in a small bit of jQuery to show how it will look like.
$(function(){
$("button.overlay").click(function(){
$(this).hide();
});
});
.story{
width: 250px;
height: 100px;
border: 1px solid black;
text-align:center;
position: relative;
}
.overlay{
position: absolute;
top:0px;
left:0px;
height: 100%;
width:100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="story">
Here goes the story!
<button class="overlay">read story button</button>
</div>
Im having this issue with the Login page where header and footer do not get resized when i make a browser window a bit smaller:
body {
position: relative;
margin: 0;
background: #FBFCFE;
font-family: Arial, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #2B2B2B;
display: flex;
min-height: 100vh;
flex-direction: column;
}
.loginPage {
max-height: 1150px;
}
.loginPageHeader {
clear: both;
background-color: #517084;
padding-top: 25px;
height: 125px;
z-index: 3;
}
.loginPageSignInForm {
position: absolute;
width: 600px;
height: 300px;
top: 40%;
left: 41%;
margin: -100px 0 0 -150px;
}
#loginPageFooter {
position: absolute;
bottom: 0;
width: 100%;
color: white;
text-align: left;
background: #517084;
padding: 10px 15px 20px 15px;
font-size: 12px;
display: block;
vertical-align: middle;
}
.loginPageHeader, .loginPageSignInForm, and loginPageFooter are inside .loginPage
The header and the footer are kinda huge when the browser is smaller and the signin form is not aligned in the center.
Screenshot
<div className="loginPage">
<div className="loginPageHeader col-lg-12">
<div className="floatleft secservices">
<img src={require('../../images/some-image.png')}/>
</div>
</div>
<div className="loginContainer"></div>
<div className="loginPageSignInForm">
<h2 className="form-signin-heading">Log in to Home</h2>
{errorLogin}
<form className="form-signin" onSubmit={this.formSubmit}>
<input onChange={this.setEmail} type="email" className="login-form-control"
autoComplete="email" placeholder="Email" required></input>
<input onChange={this.setPass} type="password" className="login-form-control"
autoComplete="new-password" placeholder="Password" required></input>
<button className="btn btn-lg btn-primary btn-block"
type="submit">Log In</button>
</form>
</div>
<LoginPageFooter />
</div>
LoginPageFooter component:
return (
<div id="loginPageFooter">
<div className="col-lg-4">
<div id="loginPageFooterText">
sdafadsfdsfasf
</div>
<div className="loginPageLinks">
<a className="footerLink"></a>
<a className="footerLink"></a>
<a className="footerLink"
>Y</a>
<a className="footerLink"></a>
</div>
</div>
<div className="col-lg-5"></div>
<div className="col-lg-3" style={styles.textAlignRight}>
<div id="contactSupport">NEED HELP? </div>
<div><a href="j.html"
title="Contacts & Procedures">Customer Support</a>
: 1-444444444</div>
<div><a href="mailto:2342314#sdafsd.com"
title="& Procedures">Email</a>
: 2342314#sdafsd.comm</div>
</div>
</div>
);
Use vh attributes. It means viewport height and is a percentage. So height: 90vh would mean 90% of the viewport height. This works in most modern browsers.
Eg.
div {
height: 90vh;
}
You can forego the rest of your silly 100% stuff on the body.
If you have a header you can also do some fun things like take it into account by using the calc function in CSS.
Eg.
div {
height: calc(100vh - 50px);
}
This will give you 100% of the viewport height, minus 50px for your header.
Hope it helped!
I need some help, I need to code this image:
This is what I have so far:
I tried adding a margin-top, padding-top, tried all combinations of position relative and absolute, I just need some ideias on how to do it.
This is how my code is structured:
<div class="background-oficina">
<div class="container">
<div class="col-xs-12 text-center">
<img class="logo" src="logo.png" alt="Oficina de Redação">
</div>
</div>
</div>
This is the css for the two classes that I'm using:
.background-oficina {
background: #fff url("bg-texture.png");
}
.logo {
padding-top: 50px;
margin: 0 auto;
}
You could use an additional absolutely positioned element to which you assign the repeated background pattern and which you put behind the original element by using z-index: -1:
html, body {
margin: 0;
}
.background-oficina {
position: relative;
border: 1px solid #333;
border-bottom: none;
}
.bg-container {
position: absolute;
z-index: -1;
left: 0;
top;
width: 100%;
height: 120px; /* or whatever height is desired */
background: url("http://placehold.it/20x15/cff");
}
.text-center {
text-align: center;
}
.logo {
padding-top: 50px;
margin: 0 auto;
}
<div class="background-oficina">
<div class="bg-container"></div>
<div class="container">
<div class="col-xs-12 text-center">
<img class="logo" src="http://placehold.it/200x150/fb7" alt="Oficina de Redação">
</div>
</div>
</div>
Your trying this, you can set default height and width to parent div that consist of that logo then using position:absolute you can push that out of parent div, but don't add overflow:hidden to parent div or else it hides your image or element that you are trying to push outside parent div as hidden.
.background-oficina {
background: #fff url("https://via.placeholder.com/800x100/000") no-repeat;
box-shadow: inset 0 0 0 1000px rgba(255, 255, 255, 0.2);
background-size: 100% 100%;
width: 100%;
height: 100px;
position: relative; /*Add this*/
}
.logo {
padding-top: 50px;
margin: 0px auto;
position: absolute; /*Add this*/
bottom: -20px; /*Add this*/
}
<div class="background-oficina padding margin-bottom">
<div class="container">
<div class="col-xs-12 text-center margin-bottom">
<img class="logo" src="https://via.placeholder.com/50/ff2" alt="Oficina de Redação">
</div>
</div>
</div>