So I am trying to add a partial {{> img-bg}} inside an inline style (just to keep things tidy). It works but something isn't quite right as when I try and match up the divs they don't match up.
Maybe this isn't the best way - ultimately what i want to do is have a background image and insert that image from a yml {{#each work.case-study-pk}} file along with other various bits of info.
Any ideas?
{{#each work.case-study-pk}}
<div class="grid-x">
<div class="cell small-12 medium-8 img-double-height foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="top-left down">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
<div class="cell small-12 medium-4">
<div class="grid-y tile-y-bg-double-height">
{{#each work.case-study-brixtar}}
<div class="cell small-6 medium-6 large-6 tile2 aligner-left foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="align-self-bottom down tile-padding ">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}} {{#each work.case-study-memontus}}
<div class="cell small-6 medium-6 large-6 tile2 aligner-left foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="align-self-bottom down tile-padding ">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
</div>
</div>
</div>
<div class="grid-container full">
<div class="grid-x align-center-middle text-center">
<div class="cell small-12 medium-4">
{{#each work.case-study-umeax}}
<div class="grid-y tile-y-bg-single-height">
<div class="cell small-12 medium-12 large-12 tile4 aligner-left foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="align-self-bottom down tile-padding">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
</div>
</div>
<div class="cell small-12 medium-8 img-single-height aligner cell-text-padder">
<h3 class="medium p-white ">Floe is the world’s greatest design agency, apart from a few others. But the few others eat million dollar budgets for breakfast – we eat porridge!</h3>
</div>
</div>
</div>
<div class="grid-x">
{{#each work.case-study-racefox}}
<div class="cell small-12 medium-6 img-double-height foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="top-left down">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}} {{#each work.case-study-interflora}}
<div class="cell small-12 medium-6 img-double-height foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="top-left down">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
</div>
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-position: center;
background-repeat: no-repeat;
case-study-pk:
-
img: ../assets/img/case8.jpg
bg-img: ../assets/img/case8.jpg
title: Personalkollen
sub-title: Brandning and webdesign
link: brixtar.html
CTA: Read more
case-study-brixtar:
-
img: ../assets/img/brix-1.jpg
title: Brixtar
sub-title: Brandning app design
link: brixtar.html
CTA: Read more
case-study-memontus:
-
img: ../assets/img/case7.jpg
title: Memontus
sub-title: Brandning app design
link: brixtar.html
CTA: Read more
case-study-umeax:
-
img: ../assets/img/umeax-1.jpg
title: Umeå X
sub-title: Brandning and webdesign
link: brixtar.html
CTA: Read more
case-study-racefox:
-
img: ../assets/img/racefox-1.jpg
title: Racefox Run
sub-title: Brandning app design
link: brixtar.html
CTA: Read more
case-study-interflora:
-
img: ../assets/img/caseIF.jpg
title: Interflora
sub-title: Webdesign
link: brixtar.html
CTA: Read more
I think that you have a design problem with your data because on your template you iterate with {{each}} on single items (that don't seems to be in an array). Maybe my example below will help you to understand what I mean.
However I managed to have an example working and I modified as few as possible your template and your data (as I said there is a confusion in data and templating). Take a look at the snippet below and feel free to ask questions if something is unclear.
$(document).ready(function () {
var context = {
"case-study-pk": [{
"img": "../assets/img/case8.jpg",
"bg-img": "../assets/img/case8.jpg",
"title": "Personalkollen",
"sub-title": "Brandning and webdesign",
"link": "brixtar.html",
"CTA:":"Read more"}],
"case-study-brixtar":[{
"img": "../assets/img/brix-1.jpg",
"title": "Brixtar",
"sub-title": "Brandning app design",
"link": "brixtar.html",
"CTA": "Read more"}],
"case-study-memontus":[{
"img": "../assets/img/case7.jpg",
"title": "Memontus",
"sub-title": "Brandning app design",
"link": "brixtar.html",
"CTA": "Read more"}],
"case-study-umeax":[{
"img": "../assets/img/umeax-1.jpg",
"title": "Umeå X",
"sub-title": "Brandning and webdesign",
"link": "brixtar.html",
"CTA": "Read more"}],
"case-study-racefox":[{
"img": "../assets/img/racefox-1.jpg",
"title": "Racefox Run",
"sub-title": "Brandning app design",
"link": "brixtar.html",
"CTA": "Read more"}],
"case-study-interflora":[{
"img": "../assets/img/caseIF.jpg",
"title": "Interflora",
"sub-title": "Webdesign",
"link": "brixtar.html",
"CTA": "Read more"}]
};
Handlebars.registerHelper('ifEqualsChained', function() {
var options = arguments[arguments.length-1];
// Assuming that all wanted operator are '||'
valueToTest=arguments[0];
for (var i = 1; i < (arguments.length - 1); i++) {
if (valueToTest === arguments[i]) {
return options.fn(this);
}
}
return options.inverse(this);
});
var source = $("#sourceTemplate").html();
var template = Handlebars.compile(source);
var html = template(context);
$("#resultPlaceholder").html(html);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.js"></script>
<script id="sourceTemplate" type="text/x-handlebars-template">
{{#*inline "img-bg"}}
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-position: center;
background-repeat: no-repeat;
{{/inline}}
{{#each case-study-pk}}
<div class="grid-x">
<div class="cell small-12 medium-8 img-double-height foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="top-left down">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
<div class="cell small-12 medium-4">
<div class="grid-y tile-y-bg-double-height">
{{#each work.case-study-brixtar}}
<div class="cell small-6 medium-6 large-6 tile2 aligner-left foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="align-self-bottom down tile-padding ">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
{{#each work.case-study-memontus}}
<div class="cell small-6 medium-6 large-6 tile2 aligner-left foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="align-self-bottom down tile-padding ">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
</div>
</div>
</div>
<div class="grid-container full">
<div class="grid-x align-center-middle text-center">
<div class="cell small-12 medium-4">
{{#each work.case-study-umeax}}
<div class="grid-y tile-y-bg-single-height">
<div class="cell small-12 medium-12 large-12 tile4 aligner-left foo" style="background-image: url({{img}});
{{> img-bg}}">
<div class="align-self-bottom down tile-padding">
<h3 class="left-align mb-zero text-shadow">{{title}}</h3>
<h5 class="left-align upper-case text-shadow">{{sub-title}}</h5>
</div>
</div>
{{/each}}
</div>
</div>
<div class="cell small-12 medium-8 img-single-height aligner cell-text-padder">
<h3 class="medium p-white ">Floe is the world’s greatest design agency, apart from a few others. But the few others eat million dollar budgets for breakfast – we eat porridge!</h3>
</div>
</div>
</div>
</script>
<div id="resultPlaceholder">
</div>
Related
I am using Angular Material and Angular Flex-Layout in my Angular application and I have a problem on displaying the texts on mobile devices. As you can see on small scree, the labels there are cut. How would i display it not being cut or I think the other column should stack below if on mobile devices?
Check this pic below for the current output. Also is there an efficient way to iterate labels and values without to put many divs in html?
HTML
<mat-card-content fxLayout="row" fxLayoutAlign="stretch">
<mat-grid-list cols="6" rowHeight="28px">
<mat-grid-tile [colspan]="1" [rowspan]="4">
<div>
<div class="details" *ngFor="let label of labels">
<label><strong>{{ label.name }}</strong></label>
</div>
</div>
</mat-grid-tile>
<mat-grid-tile [colspan]="2" [rowspan]="4">
<div>
<div class="details">
<label>1</label>
</div>
<div class="details">
<label>Robert Williams</label>
</div>
<div class="details">
<label>robert#gmail.com</label>
</div>
<div class="details">
<label>Human Resource</label>
</div>
</div>
</mat-grid-tile>
<mat-grid-tile [colspan]="1" [rowspan]="4">
<div>
<div class="details" *ngFor="let label of labels2">
<label><strong>{{ label.name }}</strong></label>
</div>
</div>
</mat-grid-tile>
<mat-grid-tile [colspan]="2" [rowspan]="4">
<div>
<div class="details">
<label>9178384567</label>
</div>
<div class="details">
<label>Phoenix</label>
</div>
<div class="details">
<label>Male</label>
</div>
<div class="details">
<label>Aug 21, 2019</label>
</div>
</div>
</mat-grid-tile>
</mat-grid-list>
</mat-card-content>
Here is a fully responsive solution;
<mat-card-content fxLayout="row" fxLayout.xs="column" fxLayoutAlign="start stretch">
<div fxLayout="row">
<div fxLayout="column" fxFlex.xs="50%">
<div fxFlex="25%" class="details" *ngFor="let label of labels">
<label><strong>{{ label }}</strong></label>
</div>
</div>
<div fxLayout="column" fxFlex.xs="50%">
<div fxFlex="25%" class="details">
<label>1</label>
</div>
<div fxFlex="25%" class="details">
<label>Robert Williams</label>
</div>
<div fxFlex="25%" class="details">
<label>robert#gmail.com</label>
</div>
<div fxFlex="25%" class="details">
<label>Human Resource</label>
</div>
</div>
</div>
<div fxLayout="row">
<div fxLayout="column" fxFlex.xs="50%">
<div fxFlex="25%" class="details" *ngFor="let label of labels2">
<label><strong>{{ label }}</strong></label>
</div>
</div>
<div fxLayout="column" fxFlex.xs="50%">
<div fxFlex="25%" class="details">
<label>9178384567</label>
</div>
<div fxFlex="25%" class="details">
<label>Phoenix</label>
</div>
<div fxFlex="25%" class="details">
<label>Male</label>
</div>
<div fxFlex="25%" class="details">
<label>Aug 21, 2019</label>
</div>
</div>
</div>
</mat-card-content>
also i suggest adding following style to properly break text in very small screens
.details > label {
overflow-wrap: break-word;
}
Here is a working demo: https://stackblitz.com/edit/angular-ivy-9vpkl1
UPDATE
In order to have a more compact template create an array that holds labels and data together
datas = [
{label: "ID", text: "1"},
{label: "Mobile", text: "9178384567"},
{label: "Full Name", text: "Robert Williams"},
{label: "City", text: "Phoenix"},
{label: "Email", text: "robert#gmail.com"},
{label: "Gender", text: "Male"},
{label: "Department", text: "Human Resource"},
{label: "Hire Date", text: "Aug 21, 2019"},
]
<mat-card-content fxLayout="row wrap" fxLayoutAlign="start stretch">
<div fxFlex="50%" fxFlex.xs="100%" fxLayout="row" *ngFor="let data of datas">
<div fxFlex="50%" class="details">
<label><strong>{{data.label}}</strong></label>
</div>
<div fxFlex="50%" class="details">
<label>{{data.text}}</label>
</div>
</div>
</mat-card-content>
Demo: https://stackblitz.com/edit/angular-ivy-g9vt6h
I hope it helps.
I'm displaying card decks in order to show a set of articles stored in a database. This is the pretty simple piece of code I'm using:
HTML
<div class="row">
<div class="card-deck">
<template is="dom-repeat" items="{{articles}}" as="article">
<div class="col-12 col-md-4 mb-md-5">
<div
class="card"
on-tap="showViewer"
data-id$="[[article.id]]"
>
<img
class="card-img-top img-fluid vertical-image"
src$="{{getArticleImage(article)}}"
onerror$="this.src='{{defaultimage}}'"
alt="{{getArticleDescription(article)}}"
/>
<div class="card-body d-flex flex-column justify-content-center py-2">
<div class="d-flex justify-content-start align-items-center mb-2">
<img class="icon-sm mr-2 img-fluid" src={{getFavIcon(article)}}>
<span class="medium-text">
{{getSources(article)}}
</span>
</div>
<p class="card-text primary-headline medium-text">
{{article.schema:headline}}
</p>
</div>
</div>
</div>
</template>
</div>
</div>
CSS
.vertical-image {
width: 100%;
height: auto;
object-fit: cover;
object-position: center;
}
.icon-sm {
height: 20px;
width: auto;
}
.medium-text {
font-family: Raleway-Medium;
}
.primary-headline {
font-size: 25px;
line-height: 25px;
text-align: justify;
}
According to Bootstrap documentation, using the card-deck class should make all the cards in the deck to have equal width and height. However, I'm not acheiving that behaviour. Here you are a picture where you can see what I am getting.
What would be the correct way to achieve that all the images in the cards and all the cards have the same height and width?
Check this. Hope it helps.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-4 py-2">
<div class="card card-body h-100">
Card. I'm just a simple card-block.
</div>
</div>
<div class="col-sm-4 py-2">
<div class="card h-100 text-white bg-danger">
<div class="card-body">
<h3 class="card-title">Danger</h3>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
Outline
</div>
</div>
</div>
<div class="col-sm-4 py-2">
<div class="card h-100 card-body">
Card. I'm just a simple card-block, but I have a little more text!
</div>
</div>
<div class="col-sm-4 py-2">
<div class="card h-100 border-primary">
<div class="card-body">
<h3 class="card-title">Primary</h3>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
Outline
</div>
</div>
</div>
<div class="col-sm-4 py-2">
<div class="card h-100 card-body">
Card. I'm just a simple card-block.
</div>
</div>
<div class="col-sm-4 py-2">
<div class="card text-white bg-primary">
<div class="card-body">
<h3 class="card-title">Hello</h3>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
Outline
</div>
</div>
</div>
</div>
</div>
I am trying to learn Bulma and I want to show a simple page with this layout:
<header>
<hero>
<section>
<footer>
I don't understand why they overlap with each other instead of being clearly one below the other.
There is a dummy container that is obviously misplaced and hidden by the header.
The overlapping is also obvious by the search bar that is both over part of the footer and the hero.
https://codepen.io/anon/pen/bLgOWb
<nav class="navbar is-primary is-fixed-top has-text-white">
<div class="container">
<div class="navbar-brand">
<img id="logo" alt="DUB Logo" src="http://code.dlang.org/images/dub-header.png"/>
</div>
<div class="navbar-menu">
<div class="navbar-start">
<div id="navItem" class="navbar-item">Primo</div>
</div>
</div>
</div>
</nav>
<section class="section">
<div class="container dummy">
</div>
</section>
<div class="hero ">
<div class="container has-text-centered is-size-1">
<h1 class="title"> Explore and use libraries and software</h1>
</div>
</div>
<div id="search" class="container">
<div class="columns searchBlock ">
<div class="column is-paddingless">
<form>
<input class="input searchInput" type="text" placeholder="Search">
</form>
</div>
<div class='column is-3 is-paddingless'>
</div>
<div class='column is-2 is-paddingless'>
<a class='button is-primary searchButton'>Search</a>
</div>
</div>
</div>
<footer class="footer">
<div class="container is-text-centered">
<p> Footer </p>
</div>
</footer>
<script src="old.js"></script>
.hero-body is missing
<div class="hero">
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title"> Explore and use libraries and software </h1>
</div>
</div>
</div>
Bulma - Hero
I think problem with column . change column margin follow this
.columns {
marign:0;
}
In second column, I have a read more button, on click of that, text expands & the icons of 1st & 3rd column also comes down which I do not want... Somebody give me a demo template In which If I click the button, then only the icon below to the text div should come down and should not affect the position of other columns icons. I'm using this code...
<div class="grid">
<div class="row">
<div class="groups col-sm-4 col-xs-offset-4 career-description">
<h1>srv</h1>
<button class="btn-link favorite glyphicon glyphicon-bookmark CLbookmark"></button>
<h3 class="noData_Msg" style="text-align: center;">Sorry, Data is not available for this career.</h3>
<p class="brief_Desc_a">
</p>
<p class="det_DescF" ng-show="readMore">
</p>
<a class="link_b" ng-click="readMore = true" href="javascript:void(0)">Read More</a>
<a class="link_b" ng-click="readMore = false" href="javascript:void(0)">Read Less</a>
</div>
</div>
<div class="row career-cards">
<div class="groups col-sm-4">
<div class="future-trnds">
<img class="img-responsive" src="images/Future_trends_v02.png" alt="">
</div>
</div>
<div class="groups col-sm-4 col-xs-offset-8">
<div class="related-Careers">
<img class="img-responsive" src="images/Related_careers_v02.png" alt="">
</div>
</div>
</div>
<div class="row">
<div class="groups col-sm-4">
<div class="day-in-life">
<img id="no_Gray" class="img-responsive" src="images/Day_In_Life_v02.png" alt=""><img id="gray_Out" ng-Click="false" class="img-responsive gray_Icon hidden" src="images/Day_In_Life_v02.png" alt="">
</div>
</div>
<div class="groups col-sm-4">
<div class="introVideo">
<div class="vid_Dimension" style="height: 300px !important;" ng-hide="!video_Url" my-youtube code="video_Url">
</div>
<h3 class="no_Video" ng-show="!video_Url">Sorry, video is not available for this career.</h3>
</div>
</div>
<div class="groups col-sm-4">
<div class="cost-Salary">
<a href="javascript:void(0)" class="modal-cost modal-cont displayTooltip" title="Cost & Salary">
<img class="img-responsive " src="images/Cost_salary_v02.png" alt="Cost & Salary">
</a>
</div>
</div>
</div>
<div class="row">
<div class="groups col-sm-4">
<div class="honeycomb-wraper">
<div class="honeycomb" ng-include="'pages/traitTriangle.html'"></div>
</div>
</div>
<div class="groups col-sm-4">
<div class="courses_Colleges">
<img class="img-responsive " src="images/Courses_Colleges_v02.png" alt="">
</div>
</div>
<div class="groups col-sm-4">
<div class="honeycomb-wraper">
<!-- <div class="honeycomb" ng-include="'pages/iconicPeople_grid.html'"></div> -->
<div class="honeycomb" ng-include="'pages/workEnv_Hex.html'"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="content">
<div class="cont">
<div class="slide-text">
<span>Opportunity & Industries </span>
</div>
<div static-image ></div>
</div>
<div class="cont">
<div class="slide-text">
<span>Cost & salary</span>
</div>
<div class="slide-content">
<!-- <img class="img-responsive" alt="modal-image" title="modal-image" /> -->
<div ></div>
</div>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap.css">
</head>
<style>
.border{
border: 2px solid black;
}
.heightWidth{
height: 200px;
width: 200px;
}
</style>
<body>
<div class="col-lg-4 col-md-4 col-sm-12 border"> this is your first division
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
first image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
2nd image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
3rd image goes here
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 border"> this is your second divsion
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12">
your middle section the text part goess here
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 cl-sm-12 border"> this one is your third division
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
first image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
2nd image goes here
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-md-12 heightWidth border">
3rd image goes here
</div>
</div>
</div>
</body>
</html>
This will work.
What would be the best / correct method to replicate the following using bootstrap. There are four colum, each of which is 25% wide, and I would like to add an image inbetween. The columns remain 25% all the way from mobile to desktop.
Simple
<div class="row">
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
<img src="plus.png" class="img-responsive"/>
</div>
</div>
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
<img src="plus.png" class="img-responsive"/>
</div>
</div>
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
<img src="plus.png" class="img-responsive"/>
</div>
</div>
<div class="col-xs-3 pull-left">
<div class"col-xs-10">
<img src="envelop.png" class="img-responsive"/>
</div>
<div class"col-xs-2 text-center">
</div>
</div>
</div>
PS: You may use text or content for + sign ... its upto you !! I prefer text/content because it will render faster then image.
This seems to do the job, though it's a bit convoluted. The 15-column layout is tricky.
.row.shift-left {
margin-left: -20px;
}
<div class="container-fluid">
<div class="row">
<div class="col-xs-11 col-xs-offset-1">
<div class="row shift-left">
<div class="col-xs-3">
<div class="row">
<div class="col-xs-9">Words words words.</div>
<div class="col-xs-3">
<img src="http://placehold.it/300x800" class="img-responsive" />
</div>
</div>
</div>
...
Demo