I received a couple of images and I need them to scale over the whole width of the page, but in height, it should stay the same height for the purposes of the design. (Don't blame me, that's what the designer wants)
I have this HTML:
<section id="fotografie-intro">
<div class="details">
<h1>Fotografie</h1>
<span>Professionele, realistisch foto's gemaakt door een professionele fotograaf.</span>
<span>€ 75 <small>per set</small></span>
</div>
</section>
I have this CSS:
#fotografie-intro {
background: url(../img/unscaledPics/FOTOGRAFIE_headerfoto.jpg);
background-size: 100% 100%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
font-family: 'Titillium Web', sans-serif;
color: rgb(246, 246, 246);
}
#fotografie-intro .details{
background-color: rgba(0, 0, 0, 0.6);
width: 33.333333%;
}
#fotografie-intro h1 {
width: 350px;
font-size: 1.5em;
text-transform: uppercase;
font-weight: 400;
text-align: center;
padding-top: 40px;
z-index: 88;
}
#fotografie-intro span {
display: block;
width: 250px;
padding-top: 20px;
text-align: left;
padding-left: 40px;
font-weight: 100;
}
#fotografie-intro span:last-child {
font-size: 2em;
padding-left: 40px;
}
Above screenshot is how it should not look.
You could go a couple of different ways.
Background-size should do the trick.
background-size:100% 400px;
In the example the width would be 100% and the height would be fixed to 400px
if you want an image to cover it no matter what you could go with
background-position: center;
background-size: cover;
Related
I have a page which is split into 3 main parts, header, inner body, and footer as noted in the css code. i'm trying to make the page responsive and fit into a 420px max width screen, so i used a media query for this, however when i do that, the inner body's width is smaller than the width of the footer and the header, it doesnt match, but rather way too small, i would like to make it fit the overall width of the page.
#media screen and (max-width:430px) {
//header:
div.logo {
width: 900px;
height: 400px;
background-color: rgb(147, 235, 238);
-ms-flex-item-align: center;
}
.content {
width: 100%;
height: 100vh;
padding: 0;
}
//inner body
div.inner-body {
height: auto;
border-style: solid;
margin-top: 15px;
margin-bottom: 15px;
width: 235%;
position: relative;
}
div.navi {
width: 900px;
font-size: 28px;
padding-bottom: 90px;
}
form {
font-family: Verdana, Geneva, Tahoma, sans-serif;
align-items: center;
border-radius: 40px;
width: 525px;
height: 700px;
background-color: rgb(99, 198, 223);
box-shadow: 0px 15px 20px rgba(0,0,0,0.5);
margin-top:500px
}
.userlogo {
width: 200px;
border-radius: 100px;
margin-top: -35px;
}
.area {
width: 280px;
height: 30px;
border-radius: 20px;
font-size: 25px;
padding: 5px;
font-style: oblique;
}
.btn {
width: 400px;
height: 60px;
font-size: 30px;
border-radius: 20px;
background-color: rgb(54, 88, 238);
cursor: pointer;
}
//footer
footer {
display: block;
width: 900px;
padding: 0;
list-style: none;
background-color: rgb(126, 226, 230);
font-size: 20px;
height: 300px;
}
First of all you are trying to use logo with width: 900px when your screen max-width:430px. Try to avoid using px and use % or rems, and than your design will be much more responsive. Anytime you are using pixels, you always need to be sure that everything fits perfectly and you need to write the code for any occasion when % or rems will help you to adjust the sizes by themselves.
Also use box-sizing: border-box; in your body. In that way padding and border are included in the width and height, so you will have more control.
Hover gradient and background image with smooth in and out transition
so I am making a website. background-color: #212121; that has come to have a hover gradient with the background image with smooth in and out transition.
now, the transition is not smooth. It is flashing.
But one thing without changing the position and size of the .amsecta. can you help me?
<section class="m-containera">
<div class="am-secta">
<div class="contenta">
<div class="titls">Stream your favourite <br class="inlin md:hidden"> tracks right now</div>
<div class="par"> <i class="fab fa-spotify"> </i>Spotify Playlist</div>
</div>
<div class="iframe-container">
<iframe src="https://open.spotify.com/embed/artist/6ffL1W3QlzZGnP90Ffi3kY?theme=0" frameBorder="0" allowtransparency="true" allow="encrypted-media"></iframe>
</div>
</div>
</section>
body{
background-color: 212121;
}
.iframe-container {
padding-top: 29.25%;
position: relative;
}
.iframe-container iframe {
border: 0;
height: 360px;
left: 15%;
position: absolute;
top: 0px;
width: 70%;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
transition: box-shadow 0.3s ease-in-out;
}
.iframe-container iframe:hover {
box-shadow: 0 5px 20px rgb(0 0 0 / 160%);
}
.m-containera {
width: 100%;
max-width: 1517px;
margin: 0 auto;
align-content: center;
text-align: center;
}
.am-secta {
padding-top: 40px;
padding-bottom: 40px;
background-color: #212121;
z-index: 1;
transition: color 0.3s ease-in-out;
}
.am-secta:hover{
background-image:linear-gradient(180deg, rgba(33,33,33,1) 0%, rgba(29,185,84,0.5) 100%),
url("http://www.piyushcares.com/wp-content/uploads/2018/11/homepagevid.png");
background-repeat: no-repeat; /*if you have full size image then use no-repeat*/
background-position: center center top;
background-size:cover;
}
.contenta {
padding: 0 10px;
}
.titls {
font-size: 34px;
font-weight: 700;
text-align: center;
color: white;
font-family: 'Raleway';
}
.par { color: white;
text-align: center;
font-weight: normal;
font-size: 20px;
line-height: 1.5;
padding-top: 10px;
padding-bottom: 45px;
font-family: 'Raleway';
}
.inlin {
display: none;
}
.bold {
font-weight: 700;
}
Maybe, you are looking for this:
.am-secta {
padding-top: 40px;
padding-bottom: 40px;
background-color: #212121;
z-index: 1;
transition: color 0.3s ease-in-out;
}
.am-secta:hover{
background-image:linear-gradient(180deg, rgba(33,33,33,1) 0%, rgba(29,185,84,0.5) 100%),
url("http://www.piyushcares.com/wp-content/uploads/2018/11/homepagevid.png");
background-repeat: no-repeat; /*if you have full size image then use no-repeat*/
background-position: center center top;
background-size:cover;
}
this is expected output
as of now, I got this as output
How to add the text image in this scenario and how to make sure the fixed width
and height of image
html code:
.circle1 {
background-image: url(https://www.iconsdb.com/icons/preview/green/circle-xxl.png);
background-repeat: no-repeat;
background-size: 4% 100%;
padding-left: 7%;
font-size: 17px;
}
.circle2 {
background-image: url(https://www.iconsdb.com/icons/preview/green/circle-xxl.png);
background-repeat: no-repeat;
background-size: 4% 100%;
padding-left: 7%;
font-size: 17px;
}
<p class="circle1">
The additional enhancements made to the ‘Service Request Management Application’ (Phase II) increased member engagements by an additional 25%
</p>
<p class="circle2">
The cost-optimization services reduced the hosting and licensing costs by at least 60%.
</p>
.circle {
font-family: sans-serif;
font-size: 16px;
padding: 8px 0 0 40px;
position: relative;
}
.circle:before {
content: attr(data-value);
width: 32px;
height: 32px;
position: absolute;
left: 0;
top: 0;
border-radius: 50%;
font-size: 12px;
line-height: 1;
color: white;
display: flex;
align-items: center;
justify-content: center;
}
.low:before {
background: blue;
}
.high:before {
background: green;
}
<p class="circle low" data-value="25%">
The additional enhancements made to the ‘Service Request Management
Application’ (Phase II) increased member engagements by an additional 25%
</p>
<p class="circle high" data-value="60%">
The cost-optimization services reduced the hosting and licensing costs by
at least 60%.
</p>
Try this:
.circle1 {
background-image: url(https://www.iconsdb.com/icons/preview/green/circle-xxl.png);
background-repeat: no-repeat;
background-size: 4% 100%;
padding-left: 7%;
font-size: 17px;
height: 50px;
line-height: 3;
}
.circle1 span {
position: absolute;
left: 20px;
color: #fff;
}
.circle2 {
background-image: url(https://www.iconsdb.com/icons/preview/green/circle-xxl.png);
background-repeat: no-repeat;
background-size: 4% 100%;
padding-left: 7%;
font-size: 17px;
height: 50px;
line-height: 3;
}
<p class="circle1">
<span>25%</span> The additional enhancements made to the ‘Service Request Management Application’ (Phase II) increased member engagements by an additional 25%
</p>
Here is a simple solution:
.circle1 {
padding-left: 7%;
font-size: 17px;
margin-top:-45px;
margin-bottom:45px;
margin-left:10px;
}
.circle2 {
margin-top:-45px;
margin-bottom:45px;
padding-left: 7%;
font-size: 17px;
margin-left:10px;
}
.circle {
width: 40px;
height: 40px;
border-radius: 50%;
font-size: 17px;
padding-top: 2.5%;
padding-left: 1%;
padding-right: 1%;
color: #ffffff;
text-align: center;
background: blue;
}
.circle3 {
width: 40px;
height: 40px;
border-radius: 50%;
font-size: 17px;
padding-top: 2.5%;
padding-left: 1%;
padding-right: 1%;
color: #ffffff;
text-align: center;
background: green;
}
<div>
<div class="circle">25%</div>
<p class="circle1">
The additional enhancements made to the ‘Service Request Management Application’ (Phase II) increased member engagements by an additional 25%
</p>
<div class="circle3">60%</div>
<p class="circle2">
The cost-optimization services reduced the hosting and licensing costs by at least 60%.
</p>
</div>
This is probably something simple that I can't quite figure out. But I am trying to have a gif as a background to create an illusion of flowers growing with a campaign logo image over it and a donation button.
When in full screen, the background gets cut off at the bottom. Somehow the image is being pushed down. As you make the screen smaller for mobile responsiveness, the full image starts to appear (in height). I'm not sure what I am doing wrong.
Campaign Page
Any help would be much appreciated! Thank you. Below is the code I am currently using.
.header-wrapper{
width: 100%;
background-image: url(https://secure3.convio.net/little/images/content/pagebuilder/HorticultureBanner-Animated1.gif);
background-size: cover;
position: relative;
margin: 0 auto 0 auto;
font-family: "museo-sans", Helvetica, Arial, sans-serif;
}
.centered { margin-left: auto; margin-right: auto; }
.align-center { text-align: center; }
.campaign-logo {
max-width: 70%;
position: relative;
height: auto;
}
.padding-3x { padding: 45px; }
.button1{
color: #fff;
display: inline-block;
font-size: 18px;
letter-spacing: .75px;
padding: 15px 21px;
text-transform: uppercase;
text-decoration: none;
-webkit-transition: all 0.2s;
transition: all 0.2s;
vertical-align: middle;
}
.green-bg { background-color: #8ec63f;}
<div class="header-wrapper contained-12 centered align-center middle">
<img class="campaign-logo" src="https://secure3.convio.net/little/images/content/pagebuilder/horticulture_logo.png"/>
<p class="padding-3x"><a class="button1 green-bg" title="Give Now" href="Donation2?idb=[[S76:idb]]&df_id=1540&1540.donation=root">Give Now</a></p>
</div>
just add: background-position: bottom; on your header-wrapper class
Uou can use : background-position: center bottom;
.header-wrapper {
width: 100%;
background-image: url(https://secure3.convio.net/little/images/content/pagebuilder/HorticultureBanner-Animated1.gif);
background-size: cover;
background-position: center bottom;
position: relative;
margin: 0 auto 0 auto;
font-family: "museo-sans", Helvetica, Arial, sans-serif;
}
.centered {
margin-left: auto;
margin-right: auto;
}
.align-center {
text-align: center;
}
.campaign-logo {
max-width: 70%;
position: relative;
height: auto;
}
.padding-3x {
padding: 45px;
}
.button1 {
color: #fff;
display: inline-block;
font-size: 18px;
letter-spacing: .75px;
padding: 15px 21px;
text-transform: uppercase;
text-decoration: none;
-webkit-transition: all 0.2s;
transition: all 0.2s;
vertical-align: middle;
}
.green-bg {
background-color: #8ec63f;
}
<div class="header-wrapper contained-12 centered align-center middle">
<img class="campaign-logo" src="https://secure3.convio.net/little/images/content/pagebuilder/horticulture_logo.png" />
<p class="padding-3x"><a class="button1 green-bg" title="Give Now" href="Donation2?idb=[[S76:idb]]&df_id=1540&1540.donation=root">Give Now</a></p>
</div>
.header-wrapper {
width: 100%;
font-family: "museo-sans", Helvetica, Arial, sans-serif;
background: url(https://secure3.convio.net/little/images/content/pagebuilder/HorticultureBanner-Animated1.gif) no-repeat center center fixed;
background-size: cover;
}
That means inside the image but on the right section. The image is on the screen. The text should be in the right part.
So far my code is like this:
.banner{
width:100%;
background-image: url(../img/kepmerli2.jpg);
background-repeat: no-repeat;
background-size: 100%;
background-position: 65% 35% ;
padding-top: 200px;
}
.herotext{
bottom: 20px;
font-family: 'museo_slab500';
font-size: 150%;
color: #fff;
padding: 0 20px;
width: 40%;
line-height: 150%;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7);
}
<div class=" continer banner">
<div class="herotext">
<h3 >Marine Vila</h3>
<p>This is Kep Merli Marine Villa, </br> a living space redeffing design tandarts in Albania </p>
</div>
</div>
Add text-align: right; to .banner
.banner{
width:100%;
background-image: url(../img/kepmerli2.jpg);
background-repeat: no-repeat;
background-size: 100%;
background-position: 65% 35% ;
padding-top: 200px;
text-align:right;
}
.herotext{
bottom: 20px;
font-family: 'museo_slab500';
font-size: 150%;
color: #fff;
padding: 0 20px;
width: 40%;
line-height: 150%;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7);
}
<div class=" continer banner">
<div class="herotext">
<h3 >Marine Vila</h3>
<p>This is Kep Merli Marine Villa, </br> a living space redeffing design tandarts in Albania </p>
</div>
</div>
Apply text-align: right; to the banner.
http://jsfiddle.net/5y6v1o35/
Add text-align: right; and float: right; to the herotext:
http://jsfiddle.net/yeyp7sfk/1/
Add following to .herotext:
position:fixed;
right:0px;
top:0px;
Play around with top to position it correctly.
try this : http://jsfiddle.net/Lxrsmj25/
<div class=" continer banner">
<div class="herotext">
<h3 >Marine Vila</h3>
<p>This is Kep Merli Marine Villa, </br> a living space redeffing design tandarts in Albania </p>
</div>
</div>.banner {
background-image: url("http://d.fastcompany.net/multisite_files/fastcompany/imagecache/1280/poster/2013/09/3017047-poster-1280-google.jpg");
float: left;
height: 400px;
width: 100%;
}
.herotext {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.7);
bottom: 20px;
color: #fff;
float: right;
font-family: "museo_slab500";
line-height: 50%;
padding: 0 20px;
position: absolute;
right: 0;
top: 0;
height:150px;
width: 40%;
}
Try this updated JSFIDDLE
.banner{
width:100%;
background-image: url(http://www.crazymonkeydefense.com/wp-content/uploads/2014/03/black-hd-background-background-wallpapers-abstract-photo-cool-black-background.jpg);
background-repeat: no-repeat;
background-size: 100%;
background-position: 65% 35% ;
padding-top: 200px;
overflow: hidden;
}
.herotext{
float: right;
font-family: 'museo_slab500';
font-size: 150%;
color: #fff;
padding: 0 10px;
width: 40%;
line-height: 150%;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7);
}
Just add text-align: right; if you want to align text right