css layout issue when setting a section height - css

I am writing a basic website in HTML5, i have all the site structure in place and so far everything has been working well.
However I have one section that seem to go off on its own a bit.
as soon as I had a height to the section the sections moves to the top of the article behind the top two section where the actual content within the section stays in place.
<article><section class="welcome-box">
<section class="welcome-wrapper">
<div class="welcome-hello">
<div class="welcome-hellotext">HELLO, WELCOME TO SAA RECRUITMENT </div>
</div>
<div class="welcome-line"></div>
<div class="welcome-textbox">
<div class="welcome-textboxtext">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.</div>
</div>
<div class="welcome-button">
<div class="welcome-buttontext">READ MORE</div>
</div>
</section>
</section>
<section class="home-slider">
<div class="slider-wrapper">
<div id="slider">
<div class="slide1">
<img src="images/slide_1.jpg" alt="" />
</div>
<div class="slide2">
<img src="images/slide_2.jpg" alt="" />
</div>
<div class="slide3">
<img src="images/slide_3.jpg" alt="" />
</div>
<div class="slide4">
<img src="images/slide_4.jpg" alt="" />
</div>
</div>
<div id="slider-direction-nav"></div>
<div id="slider-control-nav"></div>
</div>
</section>
<!-- Slider Script -->
<script type="text/javascript">
$(document).ready(function() {
var slider = $('#slider').leanSlider({
directionNav: '#slider-direction-nav',
controlNav: '#slider-control-nav'
});
});
</script>
<!-- End Slider Script -->
<section class="about-box">
<div class="about-boxtitle">TITLE HERE</div>
<div class="about-boxline"></div>
<div class="about-boxtext"></div>
</section>
<section class="news-box">
<div class="news-boxtitle">NEWS</div>
<div class="news-boxline"></div>
<div class="news-boxtext"></div>
</section>
<section class="clients-box">
<div class="clients-boxtitle">CLIENTS</div>
<div class="clients">client</div>
<div class="clients">client</div>
<div class="clients">client</div>
</section>
</article>
The section I am having trouble with is the one with a class of "clients-box" (very last section)
Here is the CSS:
.clients-box {
width: 960px;
margin-top: 10px;
background-color: #FFF;
}
ul.clients {
width: 940px;
height: 40px;
margin: 0 auto 0;
}
ul.clients li.client {
width: 150px;
height: 40px;
display: inline-block;
background-color: #039;
clear: both;
The website is live here: http://dev.saarecruitment.com/

.clients-box needs either float: left or float: right. You can add margin: 10px auto to center it with 10px top/bottom margins.

You have used float on all the above <sections> which means that they are not occupying space. Thus this box got to the top, under the floated elements.
Easiest way would be to apply a float: left to this box as well.
An alternative method, inspired by #Mr. Alien would be to just apply clear:left to this block.

Related

How to make my sidebar fit only inside the outer div

This is my Vue code and I am using bootstrap-vue, I am using the sidebar inside the card body Ideally it should only appear inside the card-body but it's not working. How can I make it fit either inside the outer div or b-card body?
<template>
<div class="">
<div>
<b-card title="Card Title" body-class="text-center" header-tag="nav">
<template v-slot:header>
<b-nav card-header tabs>
<b-nav-item active>Active</b-nav-item>
<b-nav-item>Inactive</b-nav-item>
<b-nav-item disabled>Disabled</b-nav-item>
</b-nav>
</template>
<b-card-text>
With supporting text below as a natural lead-in to additional content.
</b-card-text>
<b-card-body>
<b-sidebar visible="true" title="Sidebar" shadow>
<div class="px-3 py-2">
<p>
Cras mattis consectetur purus sit amet fermentum. Cras justo
odio, dapibus ac facilisis in, egestas eget quam. Morbi leo
risus, porta ac consectetur ac, vestibulum at eros.
</p>
<b-img
src="https://picsum.photos/500/500/?image=54"
fluid
thumbnail
></b-img>
</div>
</b-sidebar>
</b-card-body>
<b-button variant="primary">Go somewhere</b-button>
</b-card>
</div>
</div>
</template>
The sidebar wasn't really designed to be inside a container. but instead be used as an off-canvas menu for the entire page.
However, you can hack it a bit to fit your needs with a little CSS.
The sidebar is position: fixed by default, so that it is fixed to the viewport.
You need to change this to position: absolute, so that it will be positioned based on the closest parent that is position: relative. In this case that's the card.
In the snippet the sidebar goes over the title. If you want it only inside the body, all you need to be is wrap it in another element with position: relative
new Vue({
el: "#app"
});
body {
padding: 1rem;
}
.my-sidebar.b-sidebar-outer {
position: absolute !important;
height: 100% !important;
}
.my-sidebar .b-sidebar {
position: absolute !important;
height: 100% !important;
}
<link href="https://unpkg.com/bootstrap#4.4.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://unpkg.com/bootstrap-vue#2.13.0/dist/bootstrap-vue.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.js"></script>
<script src="https://unpkg.com/bootstrap-vue#2.13.0/dist/bootstrap-vue.js"></script>
<div id="app">
<b-button v-b-toggle.sidebar-1>Toggle Sidebar</b-button>
<!-- The height is only here for the example -->
<b-card style="min-height: 300px;" class="overflow-hidden" no-body>
<b-card-header>
<b-card-title>Title</b-card-title>
</b-card-header>
<b-sidebar id="sidebar-1" title="Sidebar" shadow class="my-sidebar">
<div class="px-3 py-2">
<p>
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis
</p>
<b-img src="https://picsum.photos/500/500/?image=54" fluid thumbnail></b-img>
<p>
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis
</p>
</div>
</b-sidebar>
</b-card>
</div>
I solved by modifying the style of the element by using JQuery where top': '60px' is going to be the hight of the navbar.
mounted() {
$('#sidebar-1').css(
{'top': '60px',
'opacity': '80%'
}
);
},

Align mat-cards content (image, text and buttons)

I'm working with mat-card in a list and I have a problem with the alignment.
Here is what I have:
Here is what I want:
The code :
<div class="margin-top-20" fxFlexFill fxLayout="row wrap" fxLayout.xs="column" fxLayout.sm="column" fxLayoutGap="15px grid">
<div fxFlex="20" fxFlex.md="33" *ngFor="let advert of adverts; let i = index" class="padding-fix">
<div fxFlexFill fxLayoutAlign="center stretch">
<mat-card class="ad">
<div fxLayoutAlign="space-between center">
<img mat-card-image src="test" alt="test">
</div>
<mat-card-title>test</mat-card-title>
<mat-card-content>
<p>
test
</p>
</mat-card-content>
<mat-card-actions align="end">
</mat-card-actions>
</mat-card>
</div>
</div>
</div>
I didn't understand I can I centre the image (resize it if necessary).
EDIT: Thank coreuter's answer, I'm close to getting what I want.
the first block is not at the same height as the others. And I've got some blank space at the end of each row (I would like 5 elements per row).
The updated code:
<div class="margin-top-20" fxLayout="row wrap" fxLayoutAlign="start center" fxLayoutGap="15px">
<mat-card fxFlex="20" (click)="addProduct()" class="mat-card-add-button">
<div>
<span style="font-size:32px;text-align:center">+<br/>Add product</span>
</div>
</mat-card>
<mat-card fxFlex="20" *ngFor="let product of products; let i = index" class="product">
<img class="image" mat-card-image src="{{product.picture.uri}}" alt="photo">
<mat-card-title>{{product.name}}</mat-card-title>
<mat-card-content>
<p>
test
</p>
</mat-card-content>
<mat-card-actions align="end">
</mat-card-actions>
</mat-card>
</div>
EDIT 2:
I think it's almost perfect. I tried with a big content inside the mat-card-content div and I don't know if it's good. Here is a screenshot of what I have:
Do you think it possible to get the buttons at the same height as the big mat-card (the last one)? Another thing, I can't see the border-left of the first element of each row.
Here the updated code :
<div class="margin-top-20" fxFlexFill fxLayout="row wrap" fxLayoutAlign="start start" fxLayoutGap="20px">
<mat-card fxLayoutAlign="center center" fxFlex="0 1 calc(20% - 20px)" (click)="addProduct()" class="product" style="height:413px">
<div>
<span fxLayoutAlign="center center" style="font-size:32px;text-align:center">+<br />Add product</span>
</div>
</mat-card>
<mat-card fxFlexFill fxFlex="0 1 calc(20% - 20px)" *ngFor="let product of products; let i = index" class="product">
<img class="image" mat-card-image src="{{product.picture.uri}}" alt="photo">
<mat-card-title>{{product.name}}</mat-card-title>
<mat-card-content>
<p *ngIf="i == 3">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dapibus, leo id pulvinar vestibulum, ligula nisl tincidunt magna, eu volutpat leo neque quis justo. Fusce semper ante id mi porta porta. Pellentesque nec pretium purus. Curabitur lobortis tempus consectetur. Nam ullamcorper gravida erat sed suscipit. Morbi quis porttitor nunc. Suspendisse lacinia a turpis vitae laoreet. Aliquam pellentesque scelerisque urna. Cras vulputate nisi sed elit commodo cursus. Aenean interdum, erat at convallis dictum, urna enim tincidunt nisi, vitae tempor nisi nisi a tellus. Aliquam volutpat dui eget gravida eleifend. Nullam pulvinar justo eget tellus commodo, eget molestie dui convallis. Curabitur at fermentum lorem. Maecenas porttitor sem ut enim efficitur bibendum et vel metus.
</p>
<p *ngIf="i != 3">
test
</p>
</mat-card-content>
<mat-card-actions align="end">
<button mat-icon-button>
<mat-icon>mode_edit</mat-icon>
</button>
<button mat-icon-button>
<mat-icon>delete</mat-icon>
</button>
</mat-card-actions>
</mat-card>
</div>
Thank you again for your help, I really appreciate it!
EDIT 3: This version works! Thank you very much coreuter! See it on StackBlitz.
The mat-card-content is not fixed by the "fxFlex" property. The content goes outside the mat-card. (It's working on the last StackBlitz but not for me).
.mat-card {
padding: 18px !important; /* less padding than per default */
}
.mat-card-image {
width: calc(100% + 36px) !important; /* update padding */
margin: 0 -24px 16px -18px !important; /* update padding */
}
.mat-tab-label {
font-size: 16px !important;
}
.mat-card-title {
font-size:24px !important;
font-weight: 500 !important;
}
.mat-card-content {
font-size: 14px !important;
min-height: 30px; /* <--- to remove !!! */
}
.product {
margin-bottom: 25px;
/*min-width: 180px;
text-align: center;*/
}
/* desktop button */
.mat-card-add-button {
border: 1px dashed grey;
box-shadow:none !important;
cursor:pointer;
}
.product img {
height: 250px;
object-fit: contain;
}
<div *ngIf="products.length > 0" style="margin-left:10px;">
<div fxLayout="row wrap" fxLayoutAlign="start stretch" fxLayoutGap="20px">
<mat-card fxLayoutAlign="center center" fxFlex="0 1 calc(20% - 20px)" fxFlex.md="0 1 calc(25% - 20px)" fxFlex.sm="0 1 calc(33% - 20px)" fxHide.xs="true" (click)="addProduct()" class="product mat-card-add-button">
<div fxLayoutAlign="center center" style="font-size:32px;text-align:center">+<br />Add product</div>
</mat-card>
<mat-card fxLayout="column" fxFlex.md="0 1 calc(25% - 20px)" fxFlex="0 1 calc(20% - 20px)" fxFlex.sm="0 1 calc(33% - 20px)" fxFlex.xs="100" *ngFor="let product of products; let i = index" class="product">
<img mat-card-image src="{{product.picture.uri}}" alt="photo">
<mat-card-title>{{product.name}}</mat-card-title>
<mat-card-content fxFlex>
<p *ngIf="i == 3">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dapibus, leo id pulvinar vestibulum, ligula nisl tincidunt
magna, eu volutpat leo neque quis justo. Fusce semper ante id mi porta porta. Pellentesque nec pretium purus. Curabitur
lobortis tempus consectetur. Nam ullamcorper gravida erat sed suscipit. Morbi quis porttitor nunc. Suspendisse lacinia
a turpis vitae laoreet. Aliquam pellentesque scelerisque urna. Cras vulputate nisi sed elit commodo cursus. Aenean interdum,
erat at convallis dictum, urna enim tincidunt nisi, vitae tempor nisi nisi a tellus. Aliquam volutpat dui eget gravida
eleifend. Nullam pulvinar justo eget tellus commodo, eget molestie dui convallis. Curabitur at fermentum lorem. Maecenas
porttitor sem ut enim efficitur bibendum et vel metus.
</p>
<p *ngIf="i != 3">
test
</p>
</mat-card-content>
<mat-card-actions fxFlexAlign="end" align="end">
<button mat-icon-button>
<mat-icon>mode_edit</mat-icon>
</button>
<button mat-icon-button>
<mat-icon>delete</mat-icon>
</button>
</mat-card-actions>
</mat-card>
</div>
</div>
Since I answered your previous SO question, I'll build my answer to this question upon my previous answer. Please refer to this updated Stackblitz with images of different width and height.
EDIT: Adjusted the answer/stackblitz to make a row containing 5 elements.
Explanation
In order to keep the image always the same height I've added the class "image" to the <img>-tag (you can of course apply the css to the img-tag directly with .product img{...} as well).
<img class="image" mat-card-image src="{{product.picture.url}}" alt="photo">
and applied the following CSS:
.image{
height: 150px; /* adjust as needed */
object-fit: contain;
}
With object-fit: contain your image will always properly scaled and fully visible within the available area.
Keep in mind that object-fit is currently only fully supported by the following browsers.
EDIT:
In order to get 5 Elements within each row you have to adjust the fxLayoutGap and the calculation of the width for each element using the fxFlex attribute. Please change your code as follows..
<div class="container" fxLayout="row wrap" fxLayoutAlign="center center" fxLayoutGap="20px">
<!-- Add addProduct-button outside loop -->
<mat-card fxFlex="0 1 calc(20% - 20px)" (click)="addProduct()" class="product">
...
</mat-card>
<!-- loop over the products -->
<mat-card fxFlex="0 1 calc(20% - 20px)" *ngFor="let product of products; let i = index" class="product">
...
</mat-card>
</div>
.. and change the 20px set on the fxLayoutGap and the within the calculation of fxFlex to your desired value.
With those values now set you have to apply a min-width value, otherwise all elements will just get smaller in width and the row won't wrap:
.product{
min-width: 180px; /* adjust as desired */
min-height: 250px;
margin-bottom: 20px; /* same as fxLayoutGap for even distribution */
}
EDIT 2
To make the first element the same height as the others you have to adjust to (min-)height of the .product CSS-class to be equal to the height of the highest product.
EDIT 3 (to answer edit 2 of the question)
Since you didn't mark your question answered yet, I've modified the code you provided in your edit #2 to accomplish your desired design: stackblitz
I've changed the following:
changed the fxLayoutAlign on the container to "space-evenly stretch" instead of fxLayoutAlign="start start" this distributes all items in a row on the x-axis evenly and makes them stretch as high as the highest element of the row.
removed all fxFlexFill
added fxFlex to the mat-card-content
removed the height from the .product CSS-class
Regarding the border on the left side.. I assume your container is too close to the browser windows left side. I've change the container css in my stackblitz as well.
.ad{
display:flex;
flex-direction:coloumn;
height:100%;
}
img,mat-card-content{
flex-grow: 1;
}
mat-card-actions{
display: inline-block;
align-self: flex-end;
}
You can try this.
You may have to work with fixed sizes for the mat-card and just make sure the images fit in whatever space is available.
.margin-top-20>div>div {
display: flex;
width: 100%;
}
.ad {
width: 200px;
height: 250px;
min-height: 250px;
max-width: 200px;
border: thin solid #eee;
}
.ad>div {
width: 100%;
height: 200px;
display: flex;
justify-content: center;
align-items: center;
}
.ad>div>img {
flex: 0 1;
width: 100%;
height: auto;
}
<div class="margin-top-20" fxFlexFill fxLayout="row wrap" fxLayout.xs="column" fxLayout.sm="column" fxLayoutGap="15px grid">
<div fxFlex="20" fxFlex.md="33" *ngFor="let advert of adverts; let i = index" class="padding-fix">
<div fxFlexFill fxLayoutAlign="center stretch">
<mat-card class="ad">
<div fxLayoutAlign="space-between center">
<img mat-card-image src="https://via.placeholder.com/150x50" alt="test">
</div>
<mat-card-title>test</mat-card-title>
<mat-card-content>
<p>
test
</p>
</mat-card-content>
<mat-card-actions align="end">
</mat-card-actions>
</mat-card>
<mat-card class="ad">
<div fxLayoutAlign="space-between center">
<img mat-card-image src="https://via.placeholder.com/50x150" alt="test">
</div>
<mat-card-title>test</mat-card-title>
<mat-card-content>
<p>
test
</p>
</mat-card-content>
<mat-card-actions align="end">
</mat-card-actions>
</mat-card>
<mat-card class="ad">
<div fxLayoutAlign="space-between center">
<img mat-card-image src="https://via.placeholder.com/350x150" alt="test">
</div>
<mat-card-title>test</mat-card-title>
<mat-card-content>
<p>
test
</p>
</mat-card-content>
<mat-card-actions align="end">
</mat-card-actions>
</mat-card>
</div>
</div>
</div>

Columns in row in bootstrap are not filling page width

I have a section of a website that has 2 rows inside a container, both rows have 3 columns of class col-sm-4 and col-md-4. Both rows have 1 image in each column. All images are exactly the same size at 300px wide. The top row displays accurately, the bottom row condenses the 3 columns and leave a big area of wide space on the right side. When using the inspector, The top row columns are appearing as class col-md-4, but the buttom row columns are showing as col-sm-4. I'm not sure if this is whats causing it. I should mention also that the top row columns have paragraphs below each image. When adding the exact same paragraph content to the bottom row in just 1 column, the issue is resolved, but I don't want paragraphs here. I checked out the bootstrap CSS and my own to try and find some sore of style on <p> that could be causing this but couldn't find anything. Each row, and column have the exact same CSS. The code is below:
HTML:
<div class="wrapper">
<div class="row customer-options">
<div class="button-container">
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="images/button-icon-map2.png" alt="">
<h2>Title 1</h2>
<p>These marketing boxes are a great place to put some information. These can contain summaries of what the company does, promotional information, or anything else that is relevant to the company. These will usually be below-the-fold.</p>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="images/button-icon-pref2.png" alt="">
<h2>Title 2</h2>
<p>The images are set to be circular and responsive. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.</p>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="images/button-icon-add2.png" alt="">
<h2>Title 3</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.</p>
</div>
</div>
</div><!-- /.row -->
</div><!--wrapper-->
<hr>
<div class="wrapper">
<div class="row tap">
<div class="tap-container">
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="images/beer-tap.png" alt="">
<h2>About</h2>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="images/beer-tap.png" alt="">
<h2>Services</h2>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="images/beer-tap.png" alt="">
<h2>Contact</h2>
</div>
</div>
</div><!-- /.row -->
</div><!--wrapper-->
CSS:
.wrapper {
display: table;
}
.button-container {
padding-right: 15px;
padding-left: 15px;
}
.customer-options {
background-color: #848487;
padding-top: 20px;
height:100vh;
display: table-cell;
vertical-align: middle;
}
.tap {
background-color: #848487;
padding-top: 20px;
height:100vh;
display: table-cell;
vertical-align: middle;
text-align: center;
}
.tap-container {
padding-right: 15px;
padding-left: 15px;
}
.customer-options h2 {
text-align: center;
}
The display table and table-cell are taking precedence over the responsive image. Tables fit their content then the img-responsive will fill the new width. You can probably find a work around to achieve vertical alignment but I recommend dropping the table system and properly use bootstrap's grid system. Then you can use flexboxes to get vertical alignment.
http://jsfiddle.net/28qq8fm3/
<style>
.customer-options {
background-color: #848487;
padding-top: 20px;
vertical-align: middle;
}
.tap {
background-color: #848487;
padding-top: 20px;
vertical-align: middle;
text-align: center;
}
.customer-options h2 {
text-align: center;
}
</style>
<div>
<div class="row customer-options">
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="https://beccasheppard.files.wordpress.com/2011/09/football.jpg" alt="">
<h2>Title 1</h2>
<p>These marketing boxes are a great place to put some information. These can contain summaries of what the company does, promotional information, or anything else that is relevant to the company. These will usually be below-the-fold.</p>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="https://beccasheppard.files.wordpress.com/2011/09/football.jpg" alt="">
<h2>Title 2</h2>
<p>The images are set to be circular and responsive. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.</p>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="https://beccasheppard.files.wordpress.com/2011/09/football.jpg" alt="">
<h2>Title 3</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.</p>
</div>
</div>
<!-- /.row -->
</div>
<!--wrapper-->
<hr>
<div>
<div class="row tap">
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="http://www.cozadschools.net/wp-content/uploads/2015/02/football.png" alt="">
<h2>About</h2>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="http://www.cozadschools.net/wp-content/uploads/2015/02/football.png" alt="">
<h2>Services</h2>
</div>
<div class="col-sm-4 col-md-4">
<img class="img-circle img-responsive img-center" src="http://www.cozadschools.net/wp-content/uploads/2015/02/football.png" alt="">
<h2>Contact</h2>
</div>
</div>
<!-- /.row -->
</div>
<!--wrapper-->

Simple 2 columns layout

I would like to have a webpage with two columns. The first for buttons, and the second for content.
Here's a JsFiddle :
HTML:
<div data-role="page" data-theme="b" id="home">
<div data-role="header" data-position="fixed">
<div class="home-header">
<div class="content-header" data-tap-toggle="false">
Header
</div>
</div>
</div>
<div data-role="content">
<div>
<div class="ActionsMenu">
<button>button</button>
<button>button</button>
<button>button</button>
<button>button</button>
</div>
<div id="ActionsContent">
<h3 class="ui-bar ui-bar-a ui-corner-all">Heading</h3>
<div class="ui-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse accumsan blandit fermentum. Pellentesque cursus mauris purus, auctor commodo mi ullamcorper nec. Donec semper mattis eros, nec condimentum ante sollicitudin quis. Etiam orci sem, porttitor ut tellus nec, blandit posuere urna. Proin a arcu non lacus pretium faucibus. Aliquam sed est porttitor, ullamcorper urna nec, vehicula lorem. Cras porttitor est lorem, non venenatis diam convallis congue.</p>
</div>
</div>
</div>
</div>
<div data-role="footer" data-position="fixed" data-tap-toggle="false">
footer
</div>
CSS:
.ActionsMenu {
width: 100%;
float: none;
}
.ActionsContent {
width: 100%;
float: none;
}
#media all and (min-width: 400px) {
.ActionsMenu {
float: left;
width: 25%;
padding-right: 50px;
}
.ActionsContent {
float: none;
margin-left: 25%;
}
}
As you can see, the content is under the buttons and not where I need it...
The page also need to be responsive and display a single column for mobiles...
DEMO
Have width prpperty defined for both the divs.
As you are going for responsive design i suggest using % widths
.MainContent .ActionsMenu {
width: 25%;
float: none;
overflow-scrolling: auto;
}
.MainContent .ActionsContent {
width: 60%;
float: right;
}
Have float element to float the content right
And You should have a id ActionsMenu in HTML not class.
<div class="ActionsMenu"> ..</div>
EDIT:
You want to align to right-http://jsfiddle.net/VT9m3/11/ add padding based on that
.ActionsContent {
float: left;
width:65%;
padding-left:20px;
}
but as your padding on the same div might break at a resoultion if the width of .ActionsMenu+.Actionscontent+padding >100% so have the Action menu in another div and have width property to it then have .ActionContent and have the padding
Please replace these css lines
.ActionsMenu {
width: 25%;
float: left;
overflow-scrolling: auto;
}
#ActionsContent {
width: 60%;
float: right;
}
You're using a class selector to select an id. Either replacing id="ActionsContent" with class="ActionsContent" or replacing .ActionsContent with #ActionsContent should make sure the styles are actually applied ;)

Paragraph does not wrap with div

I am puzzled by a wrap that works 90% of the time - but breaks in specific word compositions.
It's based on the css-tricks "Don't overthink it grids" blog post, so it seems the problem already existed there at the end of the tutorial.
Live/Demo/Code: http://codepen.io/anon/pen/xdFhr
As you can see the following paragraph:
BIDFIK roolbool rackorack op deenoopaloomba ka jandalop me pep google lopski
perfect preference group call later go take foot pep universal.
Flows out of the parent div. Why?
<h1>Don't Overthink It Grids <em>(while we wait for flexbox!)</em></h1>
<div class="grid">
<div class="col-2-3">
<div class="module">
<h3>2/3</h3>
<p>BIDFIK roolbool rackorack op deenoopaloomba ka jandalop me pep google lopski perfect preference group call later go take foot pep universal.</p>
</div>
</div>
<div class="col-1-3">
<div class="module">
<h3>1/3</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies</p>
</div>
</div>
</div>
<div class="grid grid-pad">
<div class="col-2-3">
<div class="module">
<h3>2/3 (Opt-in Outside Padding)</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
</div>
</div>
<div class="col-1-3">
<div class="module">
<h3>1/3</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam.</p>
</div>
</div>
</div>
<div class="grid grid-pad">
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
</div>
<div class="grid grid-pad">
<div class="col-1-4">
<div class="module">
<h3>1/4</h3>
</div>
</div>
<div class="col-1-2">
<div class="module">
<h3>1/2</h3>
</div>
</div>
<div class="col-1-4">
<div class="module">
<h3>1/4</h3>
</div>
</div>
</div>
CSS:
* {
#include box-sizing(border-box);
}
$pad: 20px;
.grid {
background: white;
margin: 0 0 $pad 0;
&:after {
/* Or #extend clearfix */
content: "";
display: table;
clear: both;
}
}
[class*='col-'] {
float: left;
padding-right: $pad;
.grid &:last-of-type {
padding-right: 0;
}
}
.col-2-3 {
width: 66.66%;
}
.col-1-3 {
width: 33.33%;
}
.col-1-2 {
width: 50%;
}
.col-1-4 {
width: 25%;
}
.col-1-8 {
width: 12.5%;
}
.module {
padding: $pad;
background: #eee;
}
/* Opt-in outside padding */
.grid-pad {
padding: $pad 0 $pad $pad;
[class*='col-']:last-of-type {
padding-right: $pad;
}
}
body {
padding: 10px 50px 200px;
background: url(http://s.cdpn.io/3/dark_wall_#2X.png);
background-size: 300px 300px;
}
h1 {
color: white;
em {
color: #666;
font-size: 16px;
}
}
It was invisible chars/hidden characters.
I removed it with a Vim command:
:%s/\%xa0/ /gc
Where xa0 is the hex code of the char (0xA0).

Resources