please help me with this https://jsfiddle.net/duonglam271/spdqL73a/
I could not position the tree and those fished
.coral {
float: left;
padding-top: 2%;
}
.coral img {
width: 80%;
}
.col-9 {
width: 73%;
display: inline-block;
}
.col-3 {
width: 23%;
display: inline-block;
position: relative;
}
.col-2 {
width: 16.66%;
display: inline-block;
}
.skill-header {
padding-top: 2%;
text-align: center;
font-size: 100%;
}
.skill-level {
padding-left: 1%;
font-size: 100%;
}
.crab {
width: 70%;
margin-top: 20%;
}
<div class="container div-5">
<div class="row">
<div class="col-3 coral">
<img src='https://i.imgur.com/y7ciVbe.png' />
</div>
<div class="col-9">
<div class="col-12 skill-header">
<h1>Skills</h1>
</div>
<div class="col-12 skill-level">
<div class="col-2 ">
<h2>Beginner</h2>
</div>
<div class="col-2 ">
<h2>Familiar</h2>
</div>
<div class="col-2 ">
<h2>Intermediate</h2>
</div>
<div class="col-2 ">
<h2>Professional</h2>
</div>
</div>
<div class="col-2 ">
<img class="crab" src='https://i.imgur.com/UghhNt0.png' />
</div>
<div class="col-2 ">
<img class="crab" src='https://i.imgur.com/UghhNt0.png' />
</div>
<div class="col-2 ">
<img class="crab" src='https://i.imgur.com/UghhNt0.png' />
</div>
</div>
</div>
</div>
Example
I have a look and this issue you are using the wrong measurement of grid system as it's work well with 12 grids
for 4 columns as it needs to be divided to col-3 each as 12 in total. you are using col-2 which is total in 8 which left col-4 in space and cause layout issue unless you need to put Horizontal alignment.
so I suggest you have look at grid layout and it will help you much understand
suggest code that I wrote and working on my side
<div class="col-12 skill-level">
<div class="col-3">
<h2>Beginner</h2>
</div>
<div class="col-3 ">
<h2>Familiar</h2>
</div>
<div class="col-3 ">
<h2>Intermediate</h2>
</div>
<div class="col-3 ">
<h2>Professional</h2>
</div>
</div>
Please have a look at https://v4-alpha.getbootstrap.com/layout/grid/
Have a fun with code
You can use media queries for it. I added custom font-size to h2.
h2 {
font-size:16px;
}
.coral {
float: left;
padding-top: 2%;
}
.coral img {
width: 80%;
}
.col-9 {
width: 73%;
display: inline-block;
}
.col-3 {
width: 23%;
display: inline-block;
position: relative;
}
.col-2 {
width: 16.66%;
display: inline-block;
}
.skill-header {
padding-top: 2%;
text-align: center;
font-size: 100%;
}
.skill-level {
padding-left: 1%;
font-size: 100%;
}
.crab {
width: 70%;
margin-top: 20%;
}
#media only screen and (max-width: 768px){
h2 {
font-size:11px;
}
}
#media only screen and (max-width: 768px){
h2 {
font-size:9
}
}
<div class="container div-5">
<div class="row">
<div class="col-3 coral">
<img src='https://i.imgur.com/y7ciVbe.png' />
</div>
<div class="col-9">
<div class="col-12 skill-header">
<h1>Skills</h1>
</div>
<div class="col-12 skill-level">
<div class="col-2 ">
<h2>Beginner</h2>
</div>
<div class="col-2 ">
<h2>Familiar</h2>
</div>
<div class="col-2 ">
<h2>Intermediate</h2>
</div>
<div class="col-2 ">
<h2>Professional</h2>
</div>
</div>
<div class="col-2 ">
<img class="crab" src='https://i.imgur.com/UghhNt0.png' />
</div>
<div class="col-2 ">
<img class="crab" src='https://i.imgur.com/UghhNt0.png' />
</div>
<div class="col-2 ">
<img class="crab" src='https://i.imgur.com/UghhNt0.png' />
</div>
</div>
</div>
</div>
Related
I want to make a different boxes in a row: one - 33% width, second - 66% width. In a row below this I want to make same sized boxes but in reverse position like below on the picture:
Can't use every time new row with row-reverse style because client wants edit boxes in Wordpress using ACF Repeater, so it should be done only by CSS.
.row {
display: flex;
flex-wrap: wrap;
}
.box {
height: 100px;
margin-bottom: 10px;
}
.box:nth-child(even) {
flex: 0 0 66.666%;
max-width: 66.666%;
}
.box:nth-child(odd) {
flex: 0 0 33.333%;
max-width: 33.333%;
}
.box__item {
height: 100%;
border: 1px solid #000;
margin: 15px;
}
<div class='row'>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
</div>
You can do with nth-child()
.row {
display: flex;
flex-wrap: wrap;
}
.box {
height: 100px;
margin-bottom: 10px;
}
.box:nth-child(4n),
.box:nth-child(4n-3){
flex: 0 0 66.666%;
max-width: 66.666%;
}
.box:nth-child(4n-1),
.box:nth-child(4n-2){
flex: 0 0 33.333%;
max-width: 33.333%;
}
.box__item {
height: 100%;
border: 1px solid #000;
margin: 15px;
}
<div class='row'>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
</div>
so I built my layout to the exact specifications but when I try to push the .feat section up (position: absolute; margin-top: -60px;) over the header element I run into z-index issues.
I've read many posts on setting the header element to position: relative; but that's not doing it.
a visual for you: the image should be over the white background
Here's my codePen with the exact setup.
I would really love to get this, thank you for your suggestions.
You can achieve this layout without using the absolute positioning for your different sections. Foundation offers XY Grid which can be used as demonstrated in the code examples/CodePen link below:
HTML
<div class="grid-container fluid">
<div class="grid-x header">
<div class="cell auto">
<h1>Coming to the Stage</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="cell medium-8">
<div class="grid-y h-100">
<div class="cell shrink">
<div class="grid-x grid-padding-x synopsis">
<div class="cell medium-4">
<p>Synopsis</p>
</div>
<div class="cell medium-8">
<p>Comedy powerhouse Jim Gaffigan has made a career out of finding the extraordinary </p>
</div>
</div>
</div>
<div class="cell medium-shrink">
<div class="grid-x grid-padding-x metainfo">
<div class="cell medium-4">
<p>Credits</p>
</div>
<div class="cell medium-8">
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<p>Talent</p>
</div>
<div class="cell medium-6">
<p>Jim Gaffigan</p>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<p>Directors</p>
</div>
<div class="cell medium-6">
<p>Aaron Feldman</p>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<p>Producters</p>
</div>
<div class="cell medium-6">
<p>Jim Gaffigans</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell medium-4">
<div class="grid-x grid-margin-x">
<div class="cell medium-10 feat">
<img src="http://www.comedydynamicsstaging.com/wp-content/uploads/2018/11/unnamed.jpg">
</div>
<div class="cell medium-2 pagination">
1 2 3
</div>
</div>
</div>
</div>
</div>
<div class="grid-container fluid">
<div class="grid-x">
<div class="cell medium-12 extra-meta">
Extra meta
</div>
</div>
</div>
CSS
body {
padding: 0;
margin: 0;
box-sizing: border-box;
background: green;
color: #fff;
text-align: center;
}
.header {
height: 285px;
background: grey;
text-align: left;
padding: 1rem;
}
.h-100 {
height: 100%;
}
.feat img {
margin-top: -60px;
}
.synopsis {
background: red;
height: 100%;
}
.pagination {
background: blue;
}
.metainfo {
background: orange;
height: 100%;
}
#media screen and (max-width: 640px) {
.metainfo {
margin-bottom: 60px;
}
}
.extra-meta {
background: pink;
margin-top: 1rem;
padding: 1rem;
}
CodePen example
Link to CodePen example here.
Issue: So vertical alignment issue is I have two divs in the last column and I'm trying to get one to stay at top and one to stay at the bottom regardless of how the central column grows. I can work this out by using fixed heights but that's no good in this case.
Here is my code example : JS Fiddle
HTML:
<div class="row" class="property-bundle"><!-- (x) number of these -->
<div class="col-xs-11 wrapper">
<div class="row">
<div class="col-xs-2 pull-left vendor">
<img src="http://placehold.it/100x100" />
</div>
<div class="col-xs-8 properties-list">
<div class="row" class="property-line">
<div class="col-xs-2"><img src="http://placehold.it/80x140" /></div>
<div class="col-xs-10"><p>Flat 1</p></div>
</div>
<div class="row"><hr/></div>
<div class="row" class="property-line">
<div class="col-xs-2"><img src="http://placehold.it/80x140" /></div>
<div class="col-xs-10"><p>Flat 2</p></div>
</div>
<div class="row"><hr/></div>
<div class="row" class="property-line">
<div class="col-xs-2"><img src="http://placehold.it/80x140" /></div>
<div class="col-xs-10"><p>Flat 3</p></div>
</div>
</div>
<div class="col-xs-2 costs"><!-- costs column -->
<div class="row total">
<h3 class="text-right">TOTAL: £1,2M</h3><!--stay at top-->
</div>
<div class="row" class="fees"> <!--stay at bottom-->
<div class="col-xs-12">
<hr/>
<p class="text-right">+ Materials £300K</p>
<p class="text-right">+ Build £100K</p>
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
.wrapper {border: 1px solid black; padding: 10px; margin: 15px;}
.vendor {min-width: 120px;}
.properties-list {background-color: aquamarine}
.costs {vertical-align: top; min-width: 150px; vertical-align: center}
.fees {vertical-align: bottom; }
h3 {font-weight: 400}
h4 {color: green}
.total { margin-right: 0px; }
Hi you can try using flexbox
I just change your html like this:
<div class="col-xs-2 costs">
<!--stay at top-->
<div class="total">
<h3 class="text-right">TOTAL: £1,2M</h3>
</div>
<hr/>
<div class="materials">
<p class="text-right">+ Materials £300K</p>
<p class="text-right">+ Build £100K</p>
</div>
</div>
</div>
Then I add on costs div display:flex;and on total div flex-grow: 1 This flex-grow will push materials on bottom of div.
You just need to add on body, html, row and costs div height:100%
Here is css:
.costs {
vertical-align: center;
display: flex;
flex-direction: column;
height: 100%;
}
.total {
flex-grow: 1;
}
You can see example on this link: https://jsfiddle.net/3L5Lbwhn/9/
Ok I simplified this a bit, but essentially flex did what I needed so many thanks to Edin Puzic for putting me on the right lines! It also allowed me to fix the 1st and last col width and make the middle one dynamic horiontally too.
JsFiddle
<div class="row-flex">
<div class="col-flex-1">
<img src="http://placehold.it/100x100" />
</div>
<div class="col-flex-2">
<div class="row" class="property-line">
<div class="col-xs-2"><img src="http://placehold.it/80x140" /></div>
<div class="col-xs-10">
<p>Flat 1</p>
</div>
</div>
<div class="row">
<hr/>
</div>
<div class="row" class="property-line">
<div class="col-xs-2"><img src="http://placehold.it/80x140" /></div>
<div class="col-xs-10">
<p>Flat 2</p>
</div>
</div>
<div class="row">
<hr/>
</div>
<div class="row" class="property-line">
<div class="col-xs-2"><img src="http://placehold.it/80x140" /></div>
<div class="col-xs-10">
<p>Flat 3</p>
</div>
</div>
</div>
<div class="col-flex-3">
<div class="pos-top">
<div class="row right-text">
TOP right
</div>
</div>
<div class="pos-bottom">
<div class="row right-text">
<p>
BOTTOM right
</p>
</div>
</div>
</div>
</div>
CSS
.row-flex {
height: auto;
display: flex;
flex-flow: row column;
}
.col-flex-1 {
min-width: 200px;
border-left: 1px #ccc solid;
flex: 0 0;
}
.col-flex-2 {
width: 80%;
border-left: 1px #ccc solid;
flex: 1 1;
}
.col-flex-3 {
min-width: 200px;
border-left: 1px #ccc solid;
flex: 0 0;
}
.flex-container {
display: -webkit-flex;
display: flex;
width: 100%;
height: 100%;
background-color: lightgrey;
}
.pos-top {
display: -webkit-flex;
display: flex;
height: 50%;
width: 100%;
-webkit-align-items: flex-start;
align-items: flex-start;
background-color: yellow;
}
.pos-bottom {
display: -webkit-flex;
display: flex;
height: 50%;
width: 100%;
-webkit-align-items: flex-end;
align-items: flex-end;
background-color: green;
}
.right-text {
text-align: right;
width: 100%;
}
I am creating a selection link that has 10 containers. And what I want is to divide them into 5 equal columns. Now my problem is I want to expand the width of the columns. Means I dont have a container class in my parent row.
Here's my sample code:
<div id="categories-selections">
<div class="col-md-2 no-padding">
<img src="public/images/cat1.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat2.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat3.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat4.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat5.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat6.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat7.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat8.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat9.png" class="img-responsive" />
</div>
<div class="col-md-2 no-padding">
<img src="public/images/cat10.png" class="img-responsive" />
</div>
</div>
Here's what should be the output:
And here's what I have:
That's all guys I hope you can help me.
Here's the sample fiddle:
https://jsfiddle.net/mk7bdyey/
You could just create a whole new column all together
.col-xs-15,
.col-sm-15,
.col-md-15,
.col-lg-15 {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
Next you need to define width of new classes in case of different media queries.
.col-xs-15 {
width: 20%;
float: left;
}
#media (min-width: 768px) {
.col-sm-15 {
width: 20%;
float: left;
}
}
#media (min-width: 992px) {
.col-md-15 {
width: 20%;
float: left;
}
}
#media (min-width: 1200px) {
.col-lg-15 {
width: 20%;
float: left;
}
}
then you can just use like this
<div class="row">
<div class="col-md-15 col-sm-3">
...
</div>
</div>
Adjust the padding from left and right as per your requirement to the div in which you have given id="categories-selections". you can put in-line css like style="padding-left:30px; padding-right:30px;"
Greetings Overflowers,
I have an HTML page as follows:
1. HTML, BODY, DIVs and SPANs are reset to have 0px border, padding, margin and outline
2. HTML, BODY and DIV elements has display: -webkit-flex and -webkit-flex: 0 0 auto
3. HTML and BODY with height: 100vh and width: 100vw
4. Inside BODY, a DIV named #slider with display: -webkit-flex and -webkit-flex: 0 0 auto
5. Inside this #slider, two DIVs #sidebar and #main with display: -webkit-flex and -webkit-flex: 0 0 auto for both, width: 10rem for #sidebar and width: 100vw for #main
Problem: I was expecting the width of #slider to be 10rem + 100vw, but it is only 100vw even if I change the width of #main to something smaller such as 50vw!
Am I missing anything in here?
Kind regards
/*
unicode-bidi: bidi-override;
-webkit-user-modify: read-write-plaintext-only;
-webkit-touch-callout: none;
-webkit-text-size-adjust: none;
-webkit-overflow-scrolling: touch;
-webkit-transition: -webkit-transform 1s ease;
*/
body, div, html, span {
background: transparent;
border: 0px;
cursor: default;
direction: rtl;
margin: 0px;
outline: none;
padding: 0px;
position: relative;
-webkit-tap-highlight-color: transparent;
-webkit-user-select: none;
}
body, html, div {
background: black;
display: -webkit-flex;
overflow: hidden;
-webkit-flex: none;
}
body, html {
height: 100vh;
width: 100vw;
}
span {
background: white;
}
.stretch {
-webkit-flex: 1;
}
.vertical {
-webkit-flex-flow: column;
}
body>.slider {
/*-webkit-transform: translateX(10rem);*/
}
#main {
width: 100vw;
}
body>.slider>#west {
width: 10rem;
}
#filter-sort.region, #filter-sort-options.region {
width: 10rem;
}
#doc>#east {
background: orange;
height: 6rem;
width: 6rem;
-webkit-align-items: center;
-webkit-justify-content: center;
}
#doc>#center {
background: green;
}
#header, #doc-types {
height: 2.75rem;
}
#preview {
max-height: 6rem;
max-width: 6rem;
}
#search.button, #filter-sort.button {
background: red;
width: 3rem;
}
#doc-type {
background: blue;
width: 5rem;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body ng:controller="Docs">
<div class="slider">
<div id="main" class="region vertical">
<div id="header" class="region">
<div id="search" class="button"></div>
<div id="center" class="region stretch">
</div>
<div id="filter-sort" class="button"></div>
</div>
<div id="doc-types" class="region">
<div class="slider">
<div id="doc-type" class="button"></div>
</div>
</div>
<div id="docs" class="region">
<div class="slider stretch vertical">
<div id="doc" class="region">
<div id="east" class="region">
<div id="preview" class="region"></div>
</div>
<div id="center" class="region stretch vertical">
<span id="title" class="label"></span>
</div>
</div>
</div>
</div>
</div>
<div id="west" class="region">
<div class="slider">
<div id="filter-sort" class="region vertical">
<div id="header" class="region">
<span id="title" class="label">Filter and Sort</span>
</div>
<div id="grades" class="region">
<div id="center" class="region stretch vertical">
<span id="grades" class="label">Grade</span><br />
<span id="grades" class="field"></span>
</div>
<div id="west" class="region"></div>
</div>
<div id="doc-topic" class="region">
<div id="center" class="region stretch vertical">
<span id="doc-topic" class="label">Doc Topic</span><br />
<span id="doc-topic" class="field"></span>
</div>
<div id="west" class="region"></div>
</div>
<div id="course" class="region">
<div id="center" class="region stretch vertical">
<span id="course" class="label">Course</span><br />
<span id="course" class="field"></span>
</div>
<div id="west" class="region"></div>
</div>
<div id="sort" class="region">
<div id="center" class="region stretch vertical">
<span id="sort" class="label">Sort</span><br />
<span id="sort" class="field"></span>
</div>
<div id="west" class="region"></div>
</div>
</div>
<div id="filter-sort-options" class="region vertical">
<div id="header" class="region">
<div id="back" class="button"></div>
<div id="center" class="region stretch">
<span id="title" class="label">Options</span>
</div>
</div>
<div id="grades" class="region">
<div class="slider vertical">
<span id="grade" class="label"></span>
</div>
</div>
<div id="doc-topics" class="region">
<div class="slider vertical">
<span id="doc-topic" class="label"></span>
</div>
</div>
<div id="courses" class="region">
<div class="slider vertical">
<span id="course" class="label"></span>
</div>
</div>
<div id="sorts" class="region">
<div class="slider vertical">
<span id="sort" class="label"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
See http://codepen.io/anon/pen/fluKI which works as you would expect (Chrome 27)
As far as I can tell from your description, you need to set the width and height of your flex container (#slider). Using flex: 0 0 auto; on #slider won't do what you expect since it is a flex container and not a flex item itself (read: it is not in a flex container).
Also please note that flex: 0 0 auto; is the same as saying flex: none; which removes the item's flexibility.