list items not displaying correctly - html

hey guys i am using bourbon neat framework to create a responsive thumbnail gallery. Now it generated the css and somehow when i resize the thumbs seem to be out of position.
here the code i used
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
body {
margin: 0;
padding: 0;
background-color: #f4f4f4; }
.galleryContainer {
*zoom: 1;
max-width: 77.0625em;
margin-left: auto;
margin-right: auto;
max-width: 1200px !important; }
.galleryContainer:before, .galleryContainer:after {
content: " ";
display: table; }
.galleryContainer:after {
clear: both; }
.galleryContainer .galleryList {
float: left;
display: block;
margin-right: 2.35765%;
width: 100%;
border: 2px solid red; }
.galleryContainer .galleryList:last-child {
margin-right: 0; }
.galleryContainer .galleryList ul {
list-style: none;
margin: 0;
padding: 0; }
.galleryContainer .galleryList li {
float: left;
padding: 0;
margin: 0;
width: 20%;
padding: 0px; }
#media screen and (min-width: 1338px) {
.galleryContainer .galleryList li {
width: 10%; } }
.galleryContainer .galleryList img {
width: 100%;
height: 100%; }
you can check out the problem here in my demo page here DEMO
Please tell me where i am doing it wrong.
thanks.

It would appear that the float: left that you have set is causing the issue when resizing. Using li elements in this instance I would adopt a display-inline block approach. You will need to add three declarations to the parent in order to remove the margin associated with inline-block elements.
You CSS
.galleryContainer .galleryList li {
float: left; <-- remove this
display: inline-block;
padding: 0;
margin: 0;
width: 20%;
padding: 0px;
font-size: 0px;
}
.galleryContainer .galleryList ul {
list-style: none;
margin: 0;
padding: 0;
font-size: 0px; <-- add this
letter-spacing: 0px; <-- add this
word-spacing: 0px; <-- add this
}

Related

2 column responsive layout with sidebar overflow issue

I am using a column responsive layout as explained in this example script
CSS
*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
body { margin: 0; }
.columnsContainer, footer, header { position: relative; margin: .5em; }
.leftColumn, .rightColumn, footer, header { border: 1px solid #ccc; padding: 1.25em; }
.leftColumn { margin-bottom: .5em; }
.nav {
list-style: none;
margin-left: 0;
margin-bottom: 0;
padding-left: 0;
}
.nav > li,
.nav > li > a {
display: inline-block;
*display: inline;
zoom: 1;
}
.inline-items {
margin-top: 0;
}
.inline-items li {
margin-left: 0;
border-left: 1px solid black;
padding-left: 10px;
padding-right: 10px;
}
.inline-items li:first-child {
margin-left: 0;
border: none;
padding-left: 0;
padding-right: 10px;
}
.inline-items li:last-child {
padding-right: 0;
}
/* MEDIA QUERIES */
#media screen and (min-width: 47.5em ) {
.leftColumn { margin-right: 19.5em; }
.rightColumn { position: absolute; top: 0; right: 0; width: 18.75em; }
}
But my site is breaking when I am having very limited content (eg:404 page) in the main column area. The footer comes up and goes under the sidebar - see this.
I have done a lot of searching and trial error things before raising this question. How can i resolve this issue?

Align elements for RTL language

I need to show news in vertical timeline below example is perfect for what i am looking for this i can modify further to my requirement but i need same for English & Arabic language. English version : https://codepen.io/jplhomer/pen/lgfus
Modified version for Arabic (RTL) https://codepen.io/anon/pen/LboryL
#import "compass/css3";
$gray: #dddddd;
h1, h2, h3 {
font-weight: 300;
}
.container {
padding: 1em;
}
.timeline {
position: relative;
overflow: auto;
&:before {
content: '';
position: absolute;
height: 100%;
width: 5px;
background: $gray;
right: 0;
}
h2 {
background: $gray;
max-width: 6em;
margin: 0 auto 1em;
padding: 0.5em;
text-align: center;
position: relative;
clear: both;
}
ul {
list-style: none;
padding: 0 1em 0 0 ;
z-index: 1;
}
li {
background: $gray;
padding: 1em;
margin-bottom: 1em;
position: relative;
direction:rtl;
text-align:right;
&:before {
content: '';
width: 0;
height: 0;
border-top: 1em solid $gray;
border-right: 1em solid transparent;
position: absolute;
right: -1em;
top: 0;
}
}
h3 {
margin-top: 0;
}
time {
font-style: italic;
}
}
#media screen and (min-width: 40em) {
.container {
max-width: 1000px;
margin: 0 auto;
}
.timeline {
&:before {
left: 50%;
}
ul {
padding-left: 20px;
max-width: 700px;
margin: 0 auto;
}
li {
width: 42%;
}
li:nth-child(even) {
float: left;
margin-top: 2em;
}
li:nth-child(odd) {
float: right;
&:before {
border-top: 1em solid $gray;
border-right: 1em solid transparent;
left: auto;
right: -1em;
}
}
li:nth-of-type(2n+1) {
clear: both;
}
}
}
I have modified CSS to work with RTL language but the pointer for the First Element ul is showing arrow on right side which i tried to show on left breaks the arrow. I tried few thing but one or the other thing breaks in this
I fixed it by making changes to
li:nth-child(odd) {
float: right;
&:before {
border-top: 1em solid $gray;
border-left: 1em solid transparent;
right: auto;
left: -1em;
}
}
Working solution: https://codepen.io/anon/pen/LboryL

Why does this CSS add a scrollbar to my page and remove all the page's content?

I created a page with a simple form then added some very basic styling to level things out and it appears to have removed the page content and added a scroll bar.
html {
font-size:1em;
}
body {
background-color: #CCFFCC;
padding: 0;
max-width: 100%;
margin: 100%;
}
header {
padding: 0;
max-width: 100%;
margin: 100%;
}
nav {
padding: 0;
max-width: 100%;
margin: 100%;
}
nav li {
padding: 0;
max-width: 100%;
margin: 100%;
}
https://jsfiddle.net/rz9Lv837/
css
html {
font-size: 1em;
}
body {
background-color: #CCFFCC;
padding: 0;
margin: 0;
}
header {
padding: 0;
}
nav {
padding: 0;
}
nav li {
padding: 0;
}
demo
if you want to provide border to your page then try this
html {
font-size:1em;
}
body {
background-color: #CCFFCC;
max-width: 100%;
padding: 0;
border:2px solid grey;
height:1000px;
}
header {
padding: 0;
max-width: 100%;
}
nav {
padding: 0;
max-width: 100%;
}
nav li {
padding: 0;
max-width: 100%;
}
Your issue is that you have included margins on the body, header and nav, this is expanding the content out, You could simply fix this by setting the margin to 0 or just removing all instances of margin:100%;
html {
font-size:1em;
}
body {
background-color: #CCFFCC;
padding: 0;
max-width: 100%;
}
header {
padding: 0;
max-width: 100%;
}
nav {
padding: 0;
max-width: 100%;
}
nav li {
padding: 0;
max-width: 100%;
}
Demo: jsfiddle
The problem is with the margin: 100%. Remove all of those. You don't even need to set a max width to 100%!
html {
font-size:1em;
}
body {
background-color: #CCFFCC;
padding: 0;
}
nav li {
padding: 0;
}
https://jsfiddle.net/rz9Lv837/5/
Replace your css :
html {
font-size:1em;
}
body {
background-color: #CCFFCC;
padding: 0;
max-width: 100%;
}
header {
padding: 0;
max-width: 100%;
}
nav {
padding: 0;
}
nav li {
padding: 0;
max-width: 100%;
}
Kindly note giving margin is in '%' not a good practice, try to make it specific or if you need the page should be responsive so you can use media query or any of the framework.

justified all images in div without any space

How to justify all images inside a div so that there is no any space left in the left-side and the right-side of the div.
Here is my HTML:
<ul class="thumnails">
<li class="img-thum">
<img src="broward.jpg"/>
<p class="thum-capt">How a Squad of Ex-Cops Fights Police Abuses</p>
</li>
<li class="img-thum">
<img src="honey.jpg"/>
<p class="thum-capt">The Men's Rights Movement and the Women Who Love It</p>
</li>
<li class="img-thum">
<img src="bottles.jpg"/>
<p class="thum-capt">Bottled Water Comes From the Most Drought-Ridden Places in the Country</p>
</li>
<li class="img-thum">
<img src="snyder.jpg"/>
<p class="thum-capt">6 Dumb Things Dan Snyder Has Said About the Name of His Football Team</p>
</li>
</ul>
And here my CSS
If I am setting the padding-right with value, then there will be a space in the right-side.
.thumnails {
width: 100%;
display: block;
float: left;
overflow: hidden;
padding: 0;
margin: 12px auto;
position: relative;
list-style: none;
}
.thumnails .img-thum {
width: 23%;
display: inline-block;
padding: 0;
padding-right: 1.5%;
margin: 0 auto;
}
.thumnails .img-thum img {
width: 100%;
padding: 0;
margin: 0;
}
.thumnails .img-thum .thum-capt {
width: 100%;
float: left;
overflow: hidden;
display: block;
position: relative;
padding: 0;
margin: 0;
font-weight: bold;
font-size: 14px;
font-family: serif;
}
My Fiddle
Try to read this article by Chris Coyer:
http://css-tricks.com/equidistant-objects-with-css/
Your css should be like this:
.thumnails {
width: 100%;
display: block;
float: left;
overflow: hidden;
padding: 0;
margin: 12px auto;
position: relative;
list-style: none;
text-align: justify; /* <== add this */
}
.thumnails .img-thum {
width: 23%;
display: inline-block;
padding: 0;
margin: 0 auto;
}
.thumnails .img-thum img {
display: inline-block; /* <== and this */
width: 100%;
padding: 0;
margin: 0;
}
.thumnails .img-thum .thum-capt {
width: 100%;
float: left;
overflow: hidden;
display: block;
position: relative;
padding: 0;
margin: 0;
font-weight: bold;
font-size: 14px;
font-family: serif;
}
/*and this*/
.thumnails:after {
content: '';
width: 100%; /* Ensures there are at least 2 lines of text, so justification works */
display: inline-block;
}
please see this demo
To ensure proper sizing it's nearly always worth using box-sizing:border-box so that padding and borders are included in width calculations.
Then the are two simple methods (based on your current code) although there are other options available.
JSfiddle (Inline-block)
Jsfiddle (Floats)
CSS re Inline Block
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.thumnails {
width: 100%;
display: block;
float: left;
overflow: hidden;
padding: 0;
margin: 12px auto;
position: relative;
list-style: none;
background:black;
font-size:0; /* required to remove white space */
}
.thumnails .img-thum {
width: 25%;
display: inline-block; /* change to float:left for float version */
padding: 0;
margin: 0 auto;
}
.thumnails .img-thum img {
width: 100%;
padding: 0;
margin: 0;
}
.thumnails .img-thum .thum-capt {
width: 100%;
float: left;
overflow: hidden;
display: block;
position: relative;
padding: 0;
margin: 0;
font-weight: bold;
font-size: 14px;
font-family: serif;
}
try like this: Demo
Just update this css to solve this problem.
CSS:
.thumnails .img-thum {
width: 23%;
display: inline-block;
padding: 0;
margin: 0;
float:left;
}
Updated fiddle Link
Space between images: Link. Hope you need like this
Solved Your Problem >> Images Without Space and justified in middle
Test in Full Screen >> FullScreen Fiddle
Modified css
.thumnails {
width: 100%;
display: block;
float: left;
overflow: hidden;
padding: 0;
margin:1%;
position: relative;
list-style: none;
white-space:no-wrap;
}
.thumnails .img-thum {
width: 22.5%;
display: inline-block;
padding: 1%;
margin: 0 auto;
}
.thumnails .img-thum img {
width: 100%;
padding: 0;
margin: 0;
}
.thumnails .img-thum .thum-capt {
width: 100%;
float: left;
overflow: hidden;
display: block;
position: relative;
padding: 0;
margin: 0;
font-weight: bold;
font-size: 14px;
font-family: serif;
}

html/css header and footer not filling the whole space

Hello I'm having a problem with my layout, when I'm resizing it, it's not filling the whole space. Please check it out here
My sample code:
html, body {
margin: 0;
padding: 0;
height: 100%;
}
p, a, h1 {
font-family: "Trebuchet MS", Helvetica, sans-serif;
}
.container {
width: 100%;
min-height: 100%;
position: relative;
}
.content {
width: 96%;
max-width: 720px;
min-width: 600px;
margin: 0 auto;
padding: 10px;
padding-bottom: 245px; /* Height of the footer element */
}
.headerWrapper {
position: absolute;
height: 85px;
background: #19A347;
z-index: 9000;
width: 100%;
}
#header {
width: 960px;
margin: 0 auto;
position: relative;
}
.logo {
position: absolute;
}
.logoimg {
display: block;
width: 155px;
height: 85px;
text-indent: -9999px;
}
.globalnav {
float: right;
clear: right;
padding: 8px 8px 0 0;
display: block;
}
.nav-menu {
list-style: none;
margin: 0;
padding: 0;
text-align: center;
}
.nav-menu li {
display: inline;
}
.nav-menu a {
display: inline-block;
padding: 15px;
margin: 5px;
color: #fff;
font-size: 20px;
text-decoration: none;
}
.nav-menu a:hover {
color: #66C285;
}
#footer {
height: 245px;
background: #1c1c1c;
position: absolute;
bottom:0;
left:0;
width: 100%;
}
.cols-container {
margin: 0 auto;
max-width: 960px;
min-width: 900px;
overflow: hidden;
}
.cols-container div {
width: 20%;
float: left;
padding: 5px;
margin: 15px;
}
.heading {
font-size: 20px;
color: #fff;
background: #009933;
padding: 5px 0 5px 10px;
}
#footer li, a {
color: #fff;
text-decoration: none;
}
#footer a:hover {
color: #999;
};
I don't know what's making it act like this way. Help is truly appreciated.
You should change the width between header and headerWrapper:
.headerWrapper {
position: absolute;
height: 85px;
background: #19A347;
z-index: 9000;
width: 960px;
}
#header {
width: 100%;
margin: 0 auto;
position: relative;
}
You also should change these rules:
.cols-container {
margin: 0 auto;
max-width: 960px;
min-width: 900px;
overflow: hidden;
}
.content {
width: 96%;
max-width: 720px;
min-width: 600px;
margin: 0 auto;
padding: 10px;
padding-bottom: 245px; /* Height of the footer element */
}
to the min-width you want:
.cols-container {
margin: 0 auto;
max-width: 960px;
min-width: 400px;
overflow: hidden;
}
.content {
width: 96%;
max-width: 720px;
min-width: 400px;
margin: 0 auto;
padding: 10px;
padding-bottom: 245px; /* Height of the footer element */
}
JSFIDDLE