How to apply background Gradient style css - css

I want to apply nackground gradient style like this -> http://nimb.ws/Xq79Uw
Following is HTML code:
<div class="featured-title zl-artful-featured-title">
<aside class="post-meta cf">
<a aria-label="Artful Interiors" class="cat-artful-interiors" href="http://localhost/magnifissance/?cat=86">Artful Interiors</a>
</aside>
<div class="row">
<div class="columns medium-10">
<div class="post-title zl-artful-interi-title">
Enrico Fratesi Shares His Vision of Form, Tradition and Renewal
</div>
</div>
<div class="columns medium-2">
<figure class="post-gallery "></figure>
</div>
</div>
</div>
Any one have a idea for this type style then please update me.
Thanks.

It looks like the gradient is on top of the image in your example. This code using pseudo elements will do that for you, vs putting the gradient code on the div itself.
#artful_interiors .post > a {
position: relative;
}
#artful_interiors .post > a:before {
content: " ";
position: absolute;
width: 100%;
height: 100%;
background: linear-gradient( to bottom, rgba(0,0,0,0) 50%, #000 95% );
}

#zl-artful-featured-title{
background: linear-gradient(
to top,
#63B4C9 35%,
#FFFFFF 70%
);
background-repeat: no-repeat;
height:260px;
width:100%;
}
<div id="zl-artful-featured-title">
<p>Content</p>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTvbOaFeLuR9IUkcut98bJs4r7-Qm8AGcEEYiiKxiAZEiljvUS_"/>
</div>
Try this
#zl-artful-featured-title{
background-image: -webkit-linear-gradient(90deg, #63B4C9 35%, #FFFFFF 40%);
}
If not working try this
#zl-artful-featured-title{
background: linear-gradient(
to bottom,
#63B4C9 35%,
#FFFFFF 70%
);
}
Make sure you've change the # to . if your using class.
I hope it helps

Related

Bootstrap 5 - Background Cover Image With Transparant Overlay Content

I am currently trying to code a frontpage according this design, using bootstrap 5. I've managed to set the background to cover the entire page. However, I can't seem to get the white transparent overlay-block right, and the placing of the content inside. This should also be responsive according to this design.
Whats the best solution for doing this?
Currently I've got:
Startpage html
<div class="startpage">
<div class="hero">
<div class="container">
<div class="row">
<div class="col-md-7 offset-md-1">
<h1 class="pb-2 pb-md-4">Heading Title</h1>
<button class="btn btn-primary mt-3" type="button">Button Title</button>
</div>
</div>
</div>
</div>
</div>
Startpage css
.startpage {
height: 100vh;
background: url(URL HERE);
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.hero {
background-image: linear-gradient(rgba(250, 250, 250, 0.95), rgba(255, 255, 255, 0.8));
min-height: 70%;
padding-top: 200px;
}
On the navbar I've got:
header {
position: absolute;
width: 100%;
}

Radial gradiant, split a section in two CSS ellipse shape

I am trying to split my section in two, and make the middle into this half ellipse shape. But I can't do it.
.super {
background: linear-gradient(to right, grey 50%, red 50%);
}
<section class="super">
<div class="nice">
</div>
</section>
Not sure if this is the result you want but try using the clip-path property.
.super {
background-color: red;
height: 150px;
clip-path: circle(50% at 89% 54%);
}
<section class="super">
<div class="nice">
</div>
</section>
You can generate a custom clip path using a tool like: https://bennettfeely.com/clippy/
Like this?
body
{
background-color:black;
}
#wrapper
{
width:600px;
height:175px;
background-color:#3596fb;
overflow:hidden;
}
#circle
{
background-color:white;
height:600px;
width:600px;
border-radius:50%;
margin-top:-30%;
margin-left:50%;
}
<div id="wrapper">
<div id="circle">
</div>
</div>
https://jsfiddle.net/m1kwvuzd/2/

Card image alignment across a row with semantic cards

I have a row of semantic-ui cards with an image at the top of each card. However, the images can be of varying heights, meaning that the card title (immediately below the image) can be fairly low. This results in differing heights of card titles across the entire row. I would like to have all images be the same height, yet still scale to larger size screens.
I found this, but it did not solve my issues:
Image alignment within a row of divs
Here is the semantic-ui documentation for a card (mine are based off of this):
http://semantic-ui.com/views/card.html
One solution is to set background size to cover.
Second solution is to make clipping mask for box.
.card {
position: relative;
margin: auto;
display: inline-block;
background: purple;
width:200px;
height:300px;
}
.image {
width:200px;
height:200px;
background-image: url('http://image2.redbull.com/rbcom/010/2013-07-25/1331603705670_2/0010/1/900/600/2/red-bull-illume.jpg');
background-size: cover;
}
.image1 {
width:200px;
height:200px;
background-image: url('http://image2.redbull.com/rbcom/010/2013-07-25/1331603705670_2/0010/1/900/600/2/red-bull-illume.jpg');
-webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
}
<div id=background>
<div class=card>
<div class=image></div>
</div>
<div class=card>
<div class=image></div>
</div>
<div class=card>
<div class=image></div>
</div>
</div>
<div id=background>
<div class=card>
<div class=image1></div>
</div>
<div class=card>
<div class=image1></div>
</div>
<div class=card>
<div class=image1></div>
</div>
</div>

transparent background image with non transparent text in a view

I'm trying to produce a look for my mvc application that has a property from my model as a transparent background image then the title and a description as the text on the image, but I want the children of the div to not be transparent. I've looked around the internet, and have seen a few different ways to do it, like changing the background rgba to a certain value, but I can't seem to get it to work. Any help would be greatly appreciated. Thanks.
Here's my code
#foreach (var item in Model)
{
<div style="height: 250px; background-size: cover; opacity: .5; border-bottom: 3px solid #e3c340; background-image:url(#item.Image);background-size: 100% 100%; " class=" hidden-md hidden-lg img-responsive">
<div class="row" style=" background:rgba(56,255,255,0.1);;">
<h1 style="font-weight:bold;" >#item.Name </h1>
</div>
</div>
}
You can't make the background-image be semi-transparent if it isn't semi-transparent itself.
Lowering an elements opacity will do the same for it's children, which is quite logical, but can be frustrating at first.
Try this for example:
<div style="background-color: rgba(255, 0, 0, 0.5);">
<p>I am perfectly opaque!</p>
</div>
Here we set the background color to be semi-transparent.
If you want to do this with an image, you would need to put it on it's own layer like so:
<div style="position relative;">
<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url(/some/path/image.jpg); background-size: cover; opacity: 0.5;"></div>
<p>I'm still opaque!</p>
</div>

CSS Equal Height columns issue in Chrome not Safari

I'm using linear gradients to create equal height columns. In safari everything lines up and is fluid all the way from desktop to mobile.
My setup is 2 rows each containing 2 columns each column has an image and a description box underneath. The image is responsive so scales down in size but in Safari this isn't an issue everything continues to line up i.e. the edge of the gradient column (the line where the two colours meet) is in line with the image at every break point.
However in Chrome nothing lines up when you scale down. It's fine at desktop but as soon as you view smaller screen sizes the images and the line dividing the two columns are all off.
I have searched endlessly for a solution to this problem but cant's seem to find anything.
If anyone has any suggestions, it would be greatly appreciated.
HTML
<article class="rowContainer">
<div class="rowOne">
<section class="floatLeft textLightGreyArea">
<img src="..." />
<p>Description goes here</p>
</section>
<section class="floatLeft textDarkGreyArea">
<p>Description goes here</p>
<img src="..." />
</section>
</div>
</article>
<article class="rowContainer">
<div class="rowTwo">
<section class="floatLeft textLightGreyArea">
<img src="..." />
<p>Description goes here</p>
</section>
<section class="floatLeft textDarkGreyArea">
<img src="..." />
<p>Description goes here</p>
</section>
</div>
</article>
CSS
.rowContainer:after {
visibility: hidden;
display: block;
content: "";
clear: both;
height: 0;
font-size: 0;
}
.rowContainer {
display: inline-block;
}
.rowOne {
overflow: hidden;
background: #c9c9c9;
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #c9c9c9),
color-stop(49.99%, #c9c9c9), color-stop(49.99%, #e0e0e0), color-stop(100%, #e0e0e0));
background-image: -webkit-linear-gradient(left, #c9c9c9, #c9c9c9 49.99%, #e0e0e0
49.99%,
#e0e0e0 100%);
background-image: -moz-linear-gradient(left, #c9c9c9, #c9c9c9 49.99%, #e0e0e0 49.99%,
#e0e0e0 100%);
}
.rowTwo {
overflow: hidden;
background: #e0e0e0;
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #e0e0e0),
color-stop(49.99%, #e0e0e0), color-stop(49.99%, #c9c9c9), color-stop(100%, #c9c9c9));
background-image: -webkit-linear-gradient(left, #e0e0e0, #e0e0e0 49.99%, #c9c9c9
49.99%,
#c9c9c9 100%);
background-image: -moz-linear-gradient(left, #e0e0e0, #e0e0e0 49.99%, #c9c9c9 49.99%,
#c9c9c9 100%);
}
.floatLeft {
width: 49.99%;
float: left;
}
http://jsfiddle.net/Ht25w/1/
there is a bug with chrome and gradients, it's obviously not your fault. the simplest solution is to give the background gradient to each instead on the father
a solution to fix text in each box is to use display table / table cell with 50% width, give half gradient to each and bottom align the right box while positioning the text absolute to top like in this [http://jsfiddle.net/Ht25w/8/]

Resources