1) I am trying to stretch the children divs to 60% and align it in the center but it is not working. I am using flex to stretch the size of the div to 60%. See example http://plnkr.co/edit/eaLjJDbjL1KnOI4jLYyO?p=preview
<div layout="column" layout-align="center">
<div style="background-color:#00A000;height: 40px;" flex="60">
</div>
<div style="background-color:#004444;height: 40px;" flex="60">
</div>
<div style="background-color:#0077b3;height: 40px;" flex="60">
</div>
2) In Angularjs Material document it is mentioned that "to customize the size and position of elements in a layout, use flex, offset, and flex-order attributes", I don't see an example of offset.
This is what you need to do..
<div layout="column" layout-align="center">
<div layout="row" layout-align="center center">
<div style="background-color:#00A000;height: 40px;" flex="60">
</div>
</div>
<div layout="row" layout-align="center center">
<div style="background-color:#004444;height: 40px;" flex="60">
</div>
</div>
<div layout="row" layout-align="center center">
<div style="background-color:#0077b3;height: 40px;" flex="60">
</div>
</div>
</div>
Read more about layout here
+1 for nitins answer. It really helped me with my issue. Here is the plunker showing his answer in a different way using angular material cards.
The html:
<section class="content-section gridListdemoBasicUsage">
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<h1 class="text-center">The Different Ways SharePoint can help define your business</h1>
<!-- Separator -->
<md-divider ng-style="{'background': 'rgba(255, 102, 51, 0.7)'}"></md-divider>
</div>
</div>
<div layout="row" layout-align="center" data-ng-style="{'width': '100%'}">
<div class='md-padding' layout="row" layout-align="center" layout-wrap>
<md-card class="md-whiteframe-9dp" data-ng-style="{'width': '350px', 'border-radius': '6px'}" data-ng-repeat="card in spcVM.serviceCards" layout-padding>
<a data-ng-if="card.imagePath" ui-sref="{{card.link}}"><img layout-fill src="{{card.imagePath}}" class="img-rounded" alt="{{card.imageAlt}}" /></a>
<md-card-content>
<div>
<h4>{{card.title}}</h4>
<md-divider ng-style="{'background': 'rgba(255, 102, 51, 0.7)'}"></md-divider>
<br />
<p>{{card.mainContent}}</p>
</div>
</md-card-content>
<md-card-footer>
<div class="md-actions" layout="row" layout-align="center end">
<md-button ng-click="card.action($event)">View</md-button>
</div>
</md-card-footer>
</md-card>
</div>
</div>
</section>
The above is in a container-fluid div.
Related
I am trying to create a css grid inside another css grid look like it's parent grid. The size of the inner grid is smaller by 20 and 100 pixels but it won't align like the parent grid. Please check out the codepen. Thank you.
CODEPEN: https://codepen.io/centem/pen/oNvZLgP?editors=1100
<div class="grid-page">
<div class="header">
<div>HOME</div>
<div>SEARCH</div>
<div>LOGOUT</div>
</div>
<div class="menu">MENU</div>
<div class="content">
<div class="inner-grid">
<div class="inner-header">
<div>HOME</div>
<div>SEARCH</div>
<div>LOGOUT</div>
</div>
<div class="inner-menu">MENU</div>
<div class="inner-content">
CONTENT
</div>
<div class="inner-footer">FOOTER</div>
</div>
</div>
<div class="footer">FOOTER</div>
</div>
Replace the class inner-grid with the inner-grid-page. No CSS is defined for inner-grid class but I can see grids defined for inner-grid-page. Let me know if it works
<div class="grid-page">
<div class="header">
<div>HOME</div>
<div>SEARCH</div>
<div>LOGOUT</div>
</div>
<div class="menu">MENU</div>
<div class="content">
<div class="inner-grid-page">
<div class="inner-header">
<div>HOME</div>
<div>SEARCH</div>
<div>LOGOUT</div>
</div>
<div class="inner-menu">MENU</div>
<div class="inner-content">
CONTENT
</div>
<div class="inner-footer">FOOTER</div>
</div>
</div>
<div class="footer">FOOTER</div>
</div>
Using bootstrap 4 inside Vue.js, I'd like to make left and right arrows to appear at the middle of the page around the image.
Here is the code:
<div class="row">
<div class="col-1">
<span class="align-self-center"><h1>❮</h1></span>
</div>
<div class="col-9">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" :src=" getImgUrl(currentMediaUrl)">
</div>
<div class="col-1">
<span class="align-self-center"><h1>❯</h1></span>
</div>
</div>
But whatever I tamper with CSS, I can not acheive this. How can I fix this?
Well, thanks to this answer, I realized it can be done with minimal fuss, by adding a simple flex css:
.img-box {
display: flex;
align-items:center;
}
And don't forget to add img-box class:
<div class="row img-box">
<div class="col-1">
<span class="nav-arrow">❮</span>
</div>
<div class="col-9">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" :src=" getImgUrl(currentMediaUrl)">
</div>
<div class="col-1">
<span class="nav-arrow">❯</span>
</div>
</div>
Using Bootstrap cards, I'm trying to float a card-img left and the card-body right, but the float classes aren't working for me. Can anyone tell me what I'm doing wrong please?
<div class="container">
<div class="row row-eq-height">
<div class="col">
<div class="card" style="">
<img class="card-img-top" style="width: 33%; float: left;" src="img/myimg.jpg" ">
<div class="card-img-caption">caption here</div>
<div class="card-body float-xl-right">
<h5 class="card-title">Title here</h5>
<p>By A Person</p>
<p class="card-text">When in the course of human events...</p>
Link
</div>
</div>
</div>
</div>
</div>
Is your xl breakpoint is set to 1280? Because if yes, then you could just use flex-xl-row class on card element and wrap image & caption inside a div, so they stay together:
<div class="card flex-xl-row">
<div>
<img class="card-img-top" src="img/myimg.jpg">
<div class="card-img-caption">caption here</div>
</div>
<div class="card-body">
<h5 class="card-title">Title here</h5>
<p>By A Person</p>
<p class="card-text">When in the course of human events...</p>
Link
</div>
</div>
It had to do with the .card class having a display of flex. Once that was removed, I could float the content left or right.
I've image need code css:
And here my html
<div class="row dvMarTop1">
<div class="col-sm-6" >
<div class="row">
<div class="col-sm-7" >
<img src="images/img230.jpg" class="img-responsive" />
</div>
<div class="col-sm-5" style="background-color: #f1f1f1;">
<div>
<div>Tiêu điểm</div>
<div>Mark Zuckerberg thất vọng vì vệ tinh 200 triệu USD bị tên lửa SpaceX thiêu rụi</div>
</div>
</div>
</div>
<div class="row dvMarTop1" style="background-color:#fff">
<div class="col-sm-4">
<img src="http://imgur.com/79u89Sj" class="img-responsive" />
</div>
<div class="col-sm-8">
<span>
Nghệ An: Cá chết dạt do thuyền chở cá chìm
<font><i class="fa fa-clock-o dvMarTop1 dvTimeItem"></i> 20:00 | Chủ nhật, 15/06/2016</font>
</span>
</div>
</div>
</div>
But as you see I cannot set full background for col-sm-5 and set vertical center text
Can you suggest more ? tks so much
Either you didn't refresh your browser page after you edited the code or you didn't place your style.css under the other CSS links in the head part of the code.
I have implemented owl slider for cards, I tried to simulate as mobile device, it looks the card is not properly centered.
I've tried all UI grid and other center classes, they didn't work.
Here is my HTML
<div class="owl-carousel">
<div class="ui card">
<div class="image dimmable">
<div class="ui blurring inverted dimmer transition hidden">
<div class="content">
<div class="center">
<div class="ui teal button">Ver más sobre Circulo K</div>
</div>
</div>
</div>
<img src="../assets/images/stores/circulok.jpg">
</div>
<div class="content">
<div class="header">Circulo K</div>
<div class="meta">
<a class="group">Meta</a>
</div>
<div class="description">Descripción Corta</div>
</div>
<div class="extra content">
<a class="right floated created">Arbitrary</a>
<a class="friends"></a>
</div>
</div>
</div>
</div>
How do I that?
Use the centered class.
<div class="ui centered card"><br> <!-- HERE -->
<div class="image">
<img src="/path/to/image/"><br>
</div>
<div class="content">
<a class="header">Link</a><br>
</div>
</div>
Using class such as ui grid centered or ui container center aligned
For example:
<div class="ui container center aligned">
<div class="ui segment">Hello Center</div>
</div>