CSS Equal Height columns issue in Chrome not Safari - css

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/]

Related

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/

How to apply background Gradient style 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

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>

Adding background image for Bootstrap list-group-item

I have a sprite that I'm able to display per each list-group-item. However, I'm not able to individually style each image for .one, .two etc.
<div class="list-group">
ONE
TWO
<span class="list-group-item three">Share <span class="fb"><!--display FB icon--></span></span>
</div>
LESS:
Place text on left, align image on right side, works.
Now I want to style the individual images within each .list-group-item. As the images already repeat themselves, i just have to position them on the center of each anchor tag, and display certain pixel parts.
.list-group-item {
width:100%
height: 50px;
float: left;
overflow: hidden;
text-align:left;
background: url("Sprite.png") right no-repeat;
}
.one { top:0; left:-15px;}
I also tried adding images explicitly, like this:
<div class="list-group">
ONE<span class="img"></span>
TWO<span class="img"></span>
<span class="list-group-item three">Follow <span class="fb"><!--display FB icon--></span>/span>
</div>
How can I get it to work?
I don't know exactly what you want to achieve but I supposed that is something like this:
.img{
float:right;
display:inline-block;
height: 44px; /*Defines the height portion of the image we want to use*/
background: url('http://www.w3schools.com/css/img_navsprites.gif') 0 0;
}
#one{
width: 46px; /*Defines the width portion of the image we want to use*/
background-position: 0 0; /*Defines the background position (left 0px, top 0px)*/
}
#two{
width: 43px;
background-position: -47px 0; /*Defines the background position 47px to the right (#one width 46px + 1px line divider)*/
}
#three{
width: 43px;
background-position: -91px 0; /*Defines the background position 91px to the right (#home width 46px + 1px line divider + #two width 43px + 1px line divider )*/
}
.list-group-item{
overflow: hidden;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<div style="margin-bottom: 50px; text-align:center">
Lets use this image:
<img src="http://www.w3schools.com/css/img_navsprites.gif" alt="">
</div>
<div class="list-group">
ONE<span id="one" class="img"></span>
TWO<span id="two" class="img"></span>
THREE<span id="three" class="img"></span>
</div>
So you have to move your background position to change the portion of the image you want to see.
Here the full example
Anyway I really recommend you use a CSS Sprite Generator.

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>

Resources