Random space being added inside gallery. It's not padding? - html

Working on this gallery I can't figure out why it is adding the extra space on the right side on the inside of the gallery. The blue border is just there to show the gallery window and will eventually be taken away. This is all I have in the gallery css.
.gallery {
display: -ms-flexbox;
display: flex;
justify-content: space-between;
-webkit-justify-content: space-around;
-ms-flex-pack: justify;
margin: 0 auto;
border: 2px solid blue;
}
Fiddle: https://jsfiddle.net/3crrxdax/5/ Thanks.
* {
box-sizing: border-box;
font-family: Georgia, Arial, sans-serif;
}
html {
background-color: #FFFF20;
}
body {
background-color: #FFFF20;
height: 100%;
}
#wrapper {
width: 1500px;
height: 100%;
margin: auto;
background-color: #233237;
color: #FFFF20;
box-shadow: 5px 5px 5px #000000;
}
header {
color: #FFFF20;
font: Georgia, serif;
text-align: center;
}
h1 {
background-image: url(ebaylogo.png);
background-repeat: no-repeat;
background-position: right;
height: 72px;
background-size: 120px;
line-height: 200%;
margin-bottom: 0;
}
h3 {
text-align: center;
padding-top: 50px;
padding-bottom: 5px;
}
h3,
.smallp {
margin: 0;
}
nav {
text-align: center;
font-weight: bold;
}
nav a {
text-decoration: none;
color: #FFFF20;
}
nav ul li {
list-style-type: none;
display: inline;
margin-right: 30px;
padding: 2px;
border: 2px solid #FFFF20;
}
footer {
padding-top: 50px;
font-size: .70em;
font-style: italic;
text-align: center;
color: #FFFF20;
margin: auto;
text-align: center;
}
footer a {
color: #FFFF20;
}
main {
padding: 0px 20px 0px 20px;
display: block;
}
.unorderedlist {
display: flex;
display: -ms-flexbox;
flex-wrap: wrap;
-ms-flex-pack: justify;
border: 1px blue solid;
justify-content: space-between;
-webkit-flex-wrap: wrap;
-ms-flex-flow: row wrap;
padding-left: 0px;
list-style-type: none;
margin: 100px auto;
width: 60%;
height: 100%;
text-align: center;
}
.list {
padding-bottom: 50px;
background-color: #18121E;
width: 220px;
height: 375px;
box-shadow: 5px 5px 5px;
margin-bottom: 25px;
}
.list a {
text-decoration: none;
color: #FFFF20;
}
.smallp {
color: #FFFF20;
width: 300px;
}
.smallp2 {
width: 300px;
}
.secondh3 {
text-align: center;
margin-bottom: -15px;
}
.pawnstarimg {
margin-top: 50px;
border: 2px solid #FFFF20;
}
.peaceimg {
border: 2px solid #FFFF20;
order: 4;
-ms-flex-order: 4;
}
.malebox a {
color: #FFFF20;
}
.femalebox a {
color: #FFFF20;
}
a:hover {
color: #0000FF;
}
/** a:visited{
color:#000000;
Able to check a:hover without clearing cache
}**/
a:active {
color: #00FF00;
}
.test {
display: flex;
display: -ms-flexbox;
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
-ms-flex-flow: row wrap;
width: 60%;
margin: auto;
justify-content: space-around;
-ms-flex-pack: justify;
}
.testbox2 {
display: flex;
display: -ms-flexbox;
flex-direction: column;
-webkit-box-direction: normal;
-ms-flex-direction: column;
}
.testbox3 {
display: flex;
display: -ms-flexbox;
flex-direction: column;
-webkit-box-direction: normal;
-ms-flex-direction: column;
}
.gallery {
display: -ms-flexbox;
display: flex;
justify-content: space-between;
-webkit-justify-content: space-around;
-ms-flex-pack: justify;
margin: 0 auto;
border: 2px solid blue;
}
.gallery>div {
padding: 5px;
}
.gallery>div>img {
display: block;
transition: .3s transform;
}
.gallery>div:hover {
z-index: 1;
}
.gallery>div:hover>a>img {
transform: scale(2.5, 2.5);
transition: .2s transform;
}
.cf:before,
.cf:after {
display: table;
content: "";
line-height: 0;
}
<main id="wrapper">
<header>
<h1>CDC Shop</h1>
</header>
<nav>
<ul>
<li> Home</li>
<li> Shirts</li>
<li> Pants</li>
<li> Jackets</li>
<li> Shoes</li>
<li> Contact</li>
</ul>
</nav>
<div class="gallery">
<div>
<a href="angels.gif"><img src="angels.gif" height="150px" width="75px" />
</div>
<div>
<a href="angels2.jpg"><img src="angels2.jpg" height="150px" width="75px" />
</div>
</div>
<footer>
Copyright © 2017 CDCShop <br>
...#gmail.com
</footer>
</main>

Remove width: 1500px; and update to make it to good look
* { box-sizing: border-box;
font-family: Georgia, Arial, sans-serif;
}
html{
background-color:#FFFF20;
}
body{
background-color:#FFFF20;
height:100%;
}
#wrapper { //width: 1500px;
height:100%;
margin: auto;
background-color: #233237;
color: #FFFF20;
box-shadow: 5px 5px 5px #000000;
}
header{
color: #FFFF20;
font: Georgia, serif;
text-align: center;
}
h1{
background-image: url(ebaylogo.png);
background-repeat: no-repeat;
background-position: right;
height: 72px;
background-size: 120px;
line-height: 200%;
margin-bottom: 0;
}
h3{
text-align:center;
padding-top:50px;
padding-bottom:5px;
}
h3, .smallp{
margin:0;
}
nav{
text-align: center;
font-weight: bold;
}
nav a{
text-decoration: none;
color:#FFFF20;
}
nav ul li {
list-style-type: none;
margin: 10px 11px;
padding: 2px;
border: 2px solid #FFFF20;
width: fit-content;
float: left;
}
footer{
padding-top: 50px;
font-size: .70em;
font-style: italic;
text-align: center;
color: #FFFF20;
margin:auto;
text-align:center;
}
footer a{
color: #FFFF20;
}
main{
padding: 0px 20px 0px 20px;
display: block;
}
.unorderedlist{
display: flex;
display:-ms-flexbox;
flex-wrap:wrap;
-ms-flex-pack: justify;
border: 1px blue solid;
justify-content: space-between;
-webkit-flex-wrap: wrap;
-ms-flex-flow: row wrap;
padding-left:0px;
list-style-type: none;
margin: 100px auto;
width:60%;
height:100%;
text-align:center;
}
.list{
padding-bottom: 50px;
background-color: #18121E;
width:220px;
height:375px;
box-shadow: 5px 5px 5px;
margin-bottom:25px;
}
.list a{
text-decoration:none;
color:#FFFF20;
}
.smallp{
color: #FFFF20;
width:300px;
}
.smallp2{
width:300px;
}
.secondh3{
text-align:center;
margin-bottom:-15px;
}
.pawnstarimg{
margin-top:50px;
border: 2px solid #FFFF20;
}
.peaceimg{
border: 2px solid #FFFF20;
order:4;
-ms-flex-order: 4;
}
.malebox a {
color:#FFFF20;
}
.femalebox a {
color:#FFFF20;
}
a:hover{
color: #0000FF;
}
/** a:visited{
color:#000000;
Able to check a:hover without clearing cache
}**/
a:active {
color: #00FF00;
}
.test{
display:flex;
display:-ms-flexbox;
flex-wrap:wrap;
-webkit-flex-wrap: wrap;
-ms-flex-flow: row wrap;
width:60%;
margin:auto;
justify-content:space-around;
-ms-flex-pack: justify;
}
.testbox2{
display:flex;
display:-ms-flexbox;
flex-direction:column;
-webkit-box-direction: normal;
-ms-flex-direction: column;
}
.testbox3{
display:flex;
display:-ms-flexbox;
flex-direction:column;
-webkit-box-direction: normal;
-ms-flex-direction: column;
}
.gallery {
display:-ms-flexbox;
display:flex;
justify-content:space-between;
-webkit-justify-content: space-around;
-ms-flex-pack: justify;
margin:0 auto;
border:2px solid blue;
clear: both;
}
.gallery > div {
padding:5px;
}
.gallery > div > img {
display: block;
transition: .3s transform;
}
.gallery > div:hover {
z-index: 1;
}
.gallery > div:hover > a > img {
transform: scale(2.5,2.5);
transition: .2s transform;
}
.cf:before, .cf:after {
display: table;
content: "";
line-height: 0;
}
<!Doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CDC Shop</title>
<link rel="stylesheet" type="text/css" href="../test3.css">
</head>
<body>
<main id="wrapper">
<header>
<h1>CDC Shop</h1>
</header>
<nav>
<ul>
<li> Home</li>
<li> Shirts</li>
<li> Pants</li>
<li> Jackets</li>
<li> Shoes</li>
<li> Contact</li>
</ul>
</nav>
<div class="gallery">
<div>
<img src="https://i.stack.imgur.com/m8iXH.jpg?s=328&g=1" height="150px" width="75px" />
</div>
<div>
<img src="https://i.stack.imgur.com/m8iXH.jpg?s=328&g=1" height="150px" width="75px" />
</div>
</div>
<footer>
Copyright © 2017 CDCShop <br>
ccoburn713#gmail.com
</footer>
</main>
</body>
</html>

Related

Drop down box not visible

When hoovering the menu element a drop down box shall appear. It does but it is cut. Not sure what is wrong here if the Ul nav list cuts it. The drop down menu has been tested ok but not with this menu. I also tried to change the z-index, but without any result. Can you see anything that can inhibit the drop down menu to show?
var navList = document.getElementById("nav-lists");
function Show() {
navList.classList.add("_Menus-show");
}
function Hide() {
navList.classList.remove("_Menus-show");
}
*,
*::before,
*::after {
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {
font-family: sans-serif;
margin: 0;
padding: 0;
}
.container {
height: 80px;
background-color: #333333;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
overflow: hidden;
}
.container .logo {
max-width: 250px;
padding: 0 10px;
overflow: hidden;
}
.container .logo a {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 60px;
}
.container .logo a img {
max-width: 100%;
max-height: 60px;
}
.container .navbar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
padding: 0 10px;
}
.container .navbar ul {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
list-style: none;
margin: 0;
padding: 0;
}
.container .navbar ul li a {
text-decoration: none;
color: #999999;
font-size: 20px;
text-transform: uppercase;
display: block;
height: 60px;
line-height: 60px;
cursor: pointer;
padding: 0 10px;
}
.container .navbar ul li a:hover {
color: #ffffff;
background-color: rgba(23, 23, 23, 0.9);
}
.container .navbar ul .close {
display: none;
text-align: right;
padding: 10px;
}
.container .navbar ul .close span {
font-size: 40px;
display: inline-block;
border: 1px solid #cccccc;
padding: 0 10px;
cursor: pointer;
}
.container .navbar .icon-bar {
padding: 18px 8px;
width: 50px;
height: 60px;
display: none;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
cursor: pointer;
}
.container .navbar .icon-bar i {
background-color: #ffffff;
height: 2px;
}
#media only screen and (max-width: 650px) {
.container {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.container .logo {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
}
.container .navbar {
-webkit-box-flex: 0;
-ms-flex: 0;
flex: 0;
}
.container .navbar ul {
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
position: fixed;
left: 100%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
background: #ffffff;
width: 100%;
height: 100%;
overflow: auto;
-webkit-transition: left .3s;
-o-transition: left .3s;
transition: left .3s;
}
.container .navbar ul li a {
padding: 10px;
font-size: 20px;
height: auto;
line-height: normal;
color: #555555;
}
.container .navbar ul .close {
display: block;
}
.container .navbar .icon-bar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.container .navbar ._Menus-show {
left: 0;
}
}
.body {
max-width: 700px;
margin: 0 auto;
padding: 10px;
}
/* start of drop down */
/* dropdown css starts here */
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #0009f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 10;
}
.dropdown:hover .dropdown-content {
display: block;
}
.desc {
padding: 15px;
width: 400px;
height: 160px;
font-family: Arial;
}
.desc_Info {
padding: 15px;
width: 400px;
height: 220px;
font-family: Arial;
}
span {
cursor: pointer;
}
/* hand over menu item */
/* END drop down menu */
<html>
<head>
<title>Nav bar</title>
</head>
<body>
<div class="container">
<div class="logo">
<img src="./bilder/logo2.jpg" alt="Start">
</div>
<div class="navbar">
<div class="icon-bar" onclick="Show()">
<i></i>
<i></i>
<i></i>
</div>
<ul id="nav-lists">
<li class="close"><span onclick="Hide()">×</span></li>
<li class="elements">
<div class="dropdown">
Cars
<div class="dropdown-content">
<div class="desc">assadsadsad<br /><br /> asdasdsadasdsadsad
<br /><br /> adsasdsasaasdasdasdsdasad
</div>
</div>
</div>
</li>
<li>Bikes</li>
</ul>
</div>
</div>
<div class="body">
<p>Hello yes !</p>
</div>
</body>
</html>
Remove the overflow: hidden; from the .container. This cuts off the dropdown.
var navList = document.getElementById("nav-lists");
function Show() {
navList.classList.add("_Menus-show");
}
function Hide() {
navList.classList.remove("_Menus-show");
}
*,
*::before,
*::after {
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {
font-family: sans-serif;
margin: 0;
padding: 0;
}
.container {
height: 80px;
background-color: #333333;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.container .logo {
max-width: 250px;
padding: 0 10px;
overflow: hidden;
}
.container .logo a {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 60px;
}
.container .logo a img {
max-width: 100%;
max-height: 60px;
}
.container .navbar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
padding: 0 10px;
}
.container .navbar ul {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
list-style: none;
margin: 0;
padding: 0;
}
.container .navbar ul li a {
text-decoration: none;
color: #999999;
font-size: 20px;
text-transform: uppercase;
display: block;
height: 60px;
line-height: 60px;
cursor: pointer;
padding: 0 10px;
}
.container .navbar ul li a:hover {
color: #ffffff;
background-color: rgba(23, 23, 23, 0.9);
}
.container .navbar ul .close {
display: none;
text-align: right;
padding: 10px;
}
.container .navbar ul .close span {
font-size: 40px;
display: inline-block;
border: 1px solid #cccccc;
padding: 0 10px;
cursor: pointer;
}
.container .navbar .icon-bar {
padding: 18px 8px;
width: 50px;
height: 60px;
display: none;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
cursor: pointer;
}
.container .navbar .icon-bar i {
background-color: #ffffff;
height: 2px;
}
#media only screen and (max-width: 650px) {
.container {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.container .logo {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
}
.container .navbar {
-webkit-box-flex: 0;
-ms-flex: 0;
flex: 0;
}
.container .navbar ul {
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
position: fixed;
left: 100%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
background: #ffffff;
width: 100%;
height: 100%;
overflow: auto;
-webkit-transition: left .3s;
-o-transition: left .3s;
transition: left .3s;
}
.container .navbar ul li a {
padding: 10px;
font-size: 20px;
height: auto;
line-height: normal;
color: #555555;
}
.container .navbar ul .close {
display: block;
}
.container .navbar .icon-bar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.container .navbar ._Menus-show {
left: 0;
}
}
.body {
max-width: 700px;
margin: 0 auto;
padding: 10px;
}
/* start of drop down */
/* dropdown css starts here */
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #0009f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 10;
}
.dropdown:hover .dropdown-content {
display: block;
}
.desc {
padding: 15px;
width: 400px;
height: 160px;
font-family: Arial;
}
.desc_Info {
padding: 15px;
width: 400px;
height: 220px;
font-family: Arial;
}
span {
cursor: pointer;
}
/* hand over menu item */
/* END drop down menu */
<html>
<head>
<title>Nav bar</title>
</head>
<body>
<div class="container">
<div class="logo">
<img src="./bilder/logo2.jpg" alt="Start">
</div>
<div class="navbar">
<div class="icon-bar" onclick="Show()">
<i></i>
<i></i>
<i></i>
</div>
<ul id="nav-lists">
<li class="close"><span onclick="Hide()">×</span></li>
<li class="elements">
<div class="dropdown">
Cars
<div class="dropdown-content">
<div class="desc">assadsadsad<br /><br /> asdasdsadasdsadsad
<br /><br /> adsasdsasaasdasdasdsdasad
</div>
</div>
</div>
</li>
<li>Bikes</li>
</ul>
</div>
</div>
<div class="body">
<p>Hello yes !</p>
</div>
</body>
</html>

Is my CSS code not set up correctly for media queries?

Ok so first off I apologise if my title is not very clear! I'm fairly new to css and currently following the landing page project with freecodecamp, I'm at the point where I wanted to start adding media queries to my code (maybe should have added them as I went along). I'm using there example code as a reference to see what I should be doing, but it just seems that no matter what media queries I add the page doesn't respond how I expect it too, or it just messes up the whole css code!
Here is a link to my codepen - https://codepen.io/rorymx/pen/XWmbbzY
and this is some of the html and css from it.
<div id="wrapper">
<header id="header">
<div id="img-div">
<img id="header-img" src="https://i.pinimg.com/236x/2d/50/8b/2d508b7019bf7b8711673825c7bd3252.jpg">
</div>
<nav id="nav-bar">
<ul>
<li><a class="nav-link" href="#features">Features</a> </li>
<li><a class="nav-link" href="#how-it-works">How it works</a> </li>
<li><a class="nav-link" href="#pricing">Pricing</a> </li>
</ul>
</nav>
</header>
</div>
please ignore the look its just temporary as the code is mainly what I'm playing about with.
For example. one of the media queries i was trying to add was
#media (max-width: 650px) header{flex-wrap: wrap;}
to the header
#media (max-width: 650px) {
nav {
margin-top: 10px;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 0 50px;
}
}
which i got from the example code, which i played about with but it just seemed to mess everything up!
If anyone could shed some light as why this may be happening, or if i've not set some things up properly, or if the code is just complete rubbish and needs starting again!
I do not see a media query in the code example that you provided via the Codepen link (https://codepen.io/rorymx/pen/XWmbbzY) that you have provided. So, the question seems a bit unclear.
That said, from the way the code looks that you have included in your description above in addition to the context that you've provided from the code that you included from your Codepen link ... it could potentially be something as simple as the way you're selecting the nav element, but I can't say this conclusively with the information given.
What I will say, however, is that if I add the following code to the bottom of the stylesheet you have provided from Codepen, it works great! Here's what I wrote:
body{
margin: 0px;
padding: 0px;
backgroun-color:
}
#wrapper{
display: flex;
height: 100vh;
flex-direction: column;
margin: 0px;
padding: 0px;
width: 100%;
}
#header{
width: 100%;
height: 100px;
background-color: grey;
position: fixed;
top: 0;
display: flex;
justify-content: space-around;
align-items: center;
}
#img-div{
display: flex;
position: relative;
background-color: grey;
width: 50%;
height: 100%;
}
#header-img{
display: flex;
position: relative;
height: 100%;
left: 25%;
}
#nav-bar > ul{
display: flex;
justify-content: space-around;
float: right;
flex-direction: row;
width: 30vw;
list-style: none;
font-size: 20px;
}
#body{
flex: 1;
display: block;
background-color: #B2B2B2;
padding-top: 100px;
width: 100vw;
}
#title{
text-align: center;
}
#submit-sec{
margin: 10px;
display:flex;
justfy-content: center;
flex-directon: column;
text-align: center;
align-items: center;
height: 100px;
}
form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: auto;
}
#email{
width: 25vw;
height: 10vh;
font-size: 18px;
}
#submit{
background-color: yellow;
font-size: 20px;
font-weight: bold;
padding: 5px 15px;
border-radius: 5px;
width: 50%;
margin: 10px 0px;
}
#submit:hover{
background-color: #C4C100 ;
transition: background-color 0.5s;
cursor: pointer;
}
#features{
display: flex;
flex-direction: column;
justify-content: center;
margin: 0px;
padding: 2px;
width: 100vw;
align-items: center;
}
.feature-div{
display: flex;
flex-direction: column;
justify-content: center;
align-items: left;
width: 60vw;
margin: 15px 0px;
}
.feature-div > h2{
margin: 2px 0px;
}
.feature-div > p{
font-size: 17px;
margin: 2px 0px;
}
#how-it-works{
display: flex;
justify-content: center;
margin: 20px 0px;
}
iframe{
max-width: 540px;
width: 100vw;
}
#pricing{
display: flex;
justify-content: center;
width: 100%;
margin: 10px 0px;
}
.price-sec{
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
width: calc(100% / 3);
border: 2px solid #000000;
margin: 50px;
padding: 0px;
border-radius: 4px;
background-color: #FBEDA6;
}
.price-sec > .price-head{
font-size: 20px;
font-weight: bold;
background-color: #E8E8E8;
width: 100%;
text-transform: uppercase;
padding: 10px 0px;
}
.price-sec > ol{
padding: 0px;
}
ol > li{
font-size: 20px;
list-style: none;
padding: 2px;
}
.price-sec > button{
border: 0;
margin: 10px;
font-weight: 400;
font-size: 20px;
padding: 5px 10px;
background-color: #FD0008;
color: white;
}
.price-sec > button:hover{
background-color: #971B1B;
transition: background-color 0.5s;
cursor: pointer;
}
#footer{
background-color: grey;
margin-top: 0px;
padding: 2px;
}
#footer > ul{
display: flex;
justify-content: flex-end;
margin: 5px;
}
#footer > ul > li{
margin: 0px 5px;
padding: 0px 10px;
list-style: none;
}
#footer > span{
display: flex;
justify-content: flex-end;
margin: 5px;
padding: 0px;
}
#media (max-width: 600px) {
nav {
background-color: red;
}
}
Adding my test code seems to work fine from a technical standpoint since a part of the nav element changes its background color from transparent to red when I shrink the window down smaller than a width of 600px as reflected by the media query I wrote. As for the code that you have provided, I was able to successfully add that code as well in the following way:
body{
margin: 0px;
padding: 0px;
backgroun-color:
}
#wrapper{
display: flex;
height: 100vh;
flex-direction: column;
margin: 0px;
padding: 0px;
width: 100%;
}
#header{
width: 100%;
height: 100px;
background-color: grey;
position: fixed;
top: 0;
display: flex;
justify-content: space-around;
align-items: center;
}
#img-div{
display: flex;
position: relative;
background-color: grey;
width: 50%;
height: 100%;
}
#header-img{
display: flex;
position: relative;
height: 100%;
left: 25%;
}
#nav-bar > ul{
display: flex;
justify-content: space-around;
float: right;
flex-direction: row;
width: 30vw;
list-style: none;
font-size: 20px;
}
#body{
flex: 1;
display: block;
background-color: #B2B2B2;
padding-top: 100px;
width: 100vw;
}
#title{
text-align: center;
}
#submit-sec{
margin: 10px;
display:flex;
justfy-content: center;
flex-directon: column;
text-align: center;
align-items: center;
height: 100px;
}
form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: auto;
}
#email{
width: 25vw;
height: 10vh;
font-size: 18px;
}
#submit{
background-color: yellow;
font-size: 20px;
font-weight: bold;
padding: 5px 15px;
border-radius: 5px;
width: 50%;
margin: 10px 0px;
}
#submit:hover{
background-color: #C4C100 ;
transition: background-color 0.5s;
cursor: pointer;
}
#features{
display: flex;
flex-direction: column;
justify-content: center;
margin: 0px;
padding: 2px;
width: 100vw;
align-items: center;
}
.feature-div{
display: flex;
flex-direction: column;
justify-content: center;
align-items: left;
width: 60vw;
margin: 15px 0px;
}
.feature-div > h2{
margin: 2px 0px;
}
.feature-div > p{
font-size: 17px;
margin: 2px 0px;
}
#how-it-works{
display: flex;
justify-content: center;
margin: 20px 0px;
}
iframe{
max-width: 540px;
width: 100vw;
}
#pricing{
display: flex;
justify-content: center;
width: 100%;
margin: 10px 0px;
}
.price-sec{
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
width: calc(100% / 3);
border: 2px solid #000000;
margin: 50px;
padding: 0px;
border-radius: 4px;
background-color: #FBEDA6;
}
.price-sec > .price-head{
font-size: 20px;
font-weight: bold;
background-color: #E8E8E8;
width: 100%;
text-transform: uppercase;
padding: 10px 0px;
}
.price-sec > ol{
padding: 0px;
}
ol > li{
font-size: 20px;
list-style: none;
padding: 2px;
}
.price-sec > button{
border: 0;
margin: 10px;
font-weight: 400;
font-size: 20px;
padding: 5px 10px;
background-color: #FD0008;
color: white;
}
.price-sec > button:hover{
background-color: #971B1B;
transition: background-color 0.5s;
cursor: pointer;
}
#footer{
background-color: grey;
margin-top: 0px;
padding: 2px;
}
#footer > ul{
display: flex;
justify-content: flex-end;
margin: 5px;
}
#footer > ul > li{
margin: 0px 5px;
padding: 0px 10px;
list-style: none;
}
#footer > span{
display: flex;
justify-content: flex-end;
margin: 5px;
padding: 0px;
}
#media (max-width: 650px) {
nav {
background-color: red;
}
header {
flex-wrap: wrap;
}
nav {
margin-top: 10px;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 0 50px;
}
}
If you add this code to your stylesheet in the Codepen that you have provided, you will see that the code is in fact working the way it is written. As far as what you wish to achieve, however, this may not be the solution that you are looking for. With a little more guidance on what the end result you wish to achieve is, I'm happy to continue to guide and help where I can.
Try this:
#media (max-width: 650px) {
#nav-bar > ul {
flex-direction: column;
}
}

Creating a CSS / HTML sidebar

I'm a fairly new web developer and I came across a problem (part of it may be a lack of understanding) but I'm having an awful time creating a sidebar with HTML or CSS. My website currently looks as follows:
There isn't much here, but my dilemma is simple: I'd like to create a sidebar. Maybe to put recent updates or other important things. Also, it'd be great to know if I'm going to go into a web development job eventually.
Here is the code:
* {
margin: 0;
padding: 0;
}
body {
background: url("https://s-media-cache-ak0.pinimg.com/originals/ca/5d/a4/ca5da4df54f6fc88531cbfff469043b0.jpg");
background-repeat: no-repeat;
}
.navbar {
width: 100%;
margin-top: 150px;
}
.navbar ul {
text-align: center;
border-top: solid 2px black;
border-left: solid 2px black;
border-right: solid 2px black;
margin-left: 400px;
margin-right: 400px;
background: #444444;
padding-top: 10px;
padding-bottom: 10px;
}
.navbar ul li {
display: inline-block;
}
.navbar ul li a {
text-decoration: none;
color: black;
font-size: 30px;
padding-left: 20px;
padding-right: 20px;
color: white;
transition: 0.3s;
padding-top: 10px;
padding-bottom: 10px;
}
.navbar ul li a:hover {
background: #8c8c8c;
}
.body {
background-color: rgba(158, 158, 158, 0.6);
margin-left: 400px;
margin-right: 400px;
border: solid 2px black;
border
}
.body p {
font-size: 20px;
padding-top: 5px;
padding-bottom: 5px;
margin-left: 20px;
margin-right: 20px;
line-height: 30px;
font-weight: 600;
}
<div class="navbar">
<ul>
<li>Home
</li>
<li>My Works
</li>
<li>Contact Me
</li>
</ul>
</div>
<div class="body">
<p>(paragraph related stuff)
</p>
</div>
I'm fairly new to Web Development (and programming entirely, really) but I've looked up multiple questions, tried many things, and nothing seemed to work. I decided to post here myself to see if I can get any solutions?
From what I understand, HTML has elements that go one under another. I've never figured out how to get elements to go side by side. This may also help when adding an image and then text beside it!
Thank you if you are able to help me :)
may be this simple sidebar can help :
http://codepen.io/Axeish/pen/GrEdMx
CSS
`
html {
height: 100%;
}
body {
height: 100%;
background-color: #e2e1e0;
overflow: hidden;
}
a, a:focus, a:active {
text-decoration: none;
-webkit-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1) 10ms;
transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1) 10ms;
}
.card {
border-radius: 2px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
padding: 20px;
background-color: #fff;
margin-bottom: 30px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.center {
width: 400px;
height: 200px;
}
.container {
height: 100%;
margin-left: 400px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
overflow-x: hidden;
overflow-y: auto;
}
.container p {
font-size: 20px;
}
.header {
position: fixed;
left: 0;
top: 0;
bottom: 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
width: 400px;
z-index: 20;
padding-top: 50px;
padding-bottom: 100px;
background-color: white;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.16), 0 0 6px rgba(0, 0, 0, 0.23);
}
.header .content .logo {
padding: 10px 20px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.header .content .logo span {
text-transform: uppercase;
text-decoration: none;
font-size: 27px;
font-weight: 200;
color: #212121;
}
.header .content .logo img {
width: 50px;
height: 50px;
margin-right: 10px;
}
.header .content ul.navigation {
list-style: none;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-ms-flex-pack: distribute;
justify-content: space-around;
padding: 0;
}
.header .content ul.navigation li {
padding: 10px;
cursor: pointer;
-webkit-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1) 10ms;
transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1) 10ms;
}
.header .content ul.navigation li a {
color: #212121;
}
.header .content ul.navigation li a.active {
text-decoration: underline;
}
.header .content ul.navigation li:hover a {
background-color: #212121;
color: white;
}
`
Check this out.
*, :before, :after {
box-sizing: border-box;
}
body {
background: url("https://s-media-cache-ak0.pinimg.com/originals/ca/5d/a4/ca5da4df54f6fc88531cbfff469043b0.jpg");
background-repeat: no-repeat;
}
.unstyled {
list-style: none;
padding: 0;
margin: 0;
}
.unstyled a {
text-decoration: none;
}
.list-inline {
overflow: hidden;
}
.list-inline li {
float: left;
}
.header {
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: 17.5em;
background: #D13513;
}
.logo {
font: 300 2em "Source Sans Pro", Helvetica, Arial, sans-serif;
text-align: center;
padding: 0;
margin: 0;
}
.logo a {
display: block;
padding: 1em 0;
color: #DFDBD9;
text-decoration: none;
transition: .15s linear color;
}
.main-nav ul {
border-top: solid 1px #3C3735;
}
.main-nav li {
border-bottom: solid 1px #3C3735;
}
.main-nav a {
padding: 1.1em 0;
color: #DFDBD9;
font: 400 1.125em "Source Sans Pro", Helvetica, Arial, sans-serif;
text-align: center;
}
.main-nav a:hover {
color: #fff;
}
.list-hover-slide li {
position: relative;
overflow: hidden;
}
.list-hover-slide a {
display: block;
position: relative;
z-index: 1;
transition: .35s ease color;
}
.list-hover-slide a:before {
content: '';
display: block;
z-index: -1;
position: absolute;
left: -100%;
top: 0;
width: 100%;
height: 100%;
border-right: solid 5px #DF4500;
background: #3C3735;
transition: .35s ease left;
}
.list-hover-slide a.is-current:before, .list-hover-slide a:hover:before {
left: 0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" rel="stylesheet"/>
<body>
<header class="header" role="banner">
<h1 class="logo">
SideNav
</h1>
<div class="nav-wrap">
<nav class="main-nav" role="navigation">
<ul class="unstyled list-hover-slide">
<li>Home</li>
<li>My Work</li>
<li>Contact Me</li>
</ul>
</nav>
<script

How do I stop text inside element p from overflowing the viewport?

I am using angular uib-accordion to display the details parsed from JSON in angularJS.
However after styling I have noticed that the paragraph text is overflowing the viewport on small resolutions.
The overflow is being caused by <p>{{position.shortDescription}}</p>
THE HTML
<div class="row" ng-show="showMeDetails">
<uib-accordion close-others="oneAtATime">
<div class="row" ng-repeat="position in departments.positions">
<uib-accordion close-others="oneAtATime">
<uib-accordion-group>
<uib-accordion-heading>
<div class="col-sm-10">
<div class="job-view">
<h4>{{position.name}}</h4>
<p>{{position.shortDescription}}</p>
</div>
</div>
<div class="col-sm-2">
<div class="apply-btn">
<button ng-click="applyAction($event,position.name)" class="btn btn-info" type="button">APPLY</button>
</div>
</div>
</uib-accordion-heading>
<div class="position-full-description"></div>
<div class="position-full-description" ng-repeat="description in position.fullDescription">
<h4>{{description.headline}}</h4>
<ul ng-if="description.type == 'list'" class="detailed_lines">
<li ng-repeat="line in description.lines">{{line}}</li>
</ul>
<p ng-if="description.type == 'paragraph'" ng-repeat="line in description.lines">{{line}}</p>
</div>
</uib-accordion-group>
</uib-accordion>
</div>
</uib-accordion>
</div>
THE CSS
.job-view {
display: flex;
-webkit-display: flex;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-justify-content: flex-start;
justify-content: flex-start;
-webkit-align-content: space-between;
align-content: space-between;
padding-left: 50px;
text-align: left;
}
Full CSS
.navbar-nav {
float: right;
}
.container-fluid .nav > li > a {
color: #333a3f;
font-weight: 700;
font-size: 16px;
}
.container-fluid .nav > li > a:focus, .nav > li:active > a {
background: -webkit-linear-gradient(top,rgba(0,179,255,0) 0%,rgba(0,179,255,0) 75%,#00b3ff 75%,#00b3ff 80%,rgba(0,179,255,0) 80%,rgba(0,179,255,0) 100%);
background: -o-linear-gradient(top,rgba(0,179,255,0) 0%,rgba(0,179,255,0) 75%,#00b3ff 75%,#00b3ff 78%,rgba(0,179,255,0) 78%,rgba(0,179,255,0) 100%);
background: -moz-linear-gradient(top,rgba(0,179,255,0) 0%,rgba(0,179,255,0) 75%,#00b3ff 75%,#00b3ff 78%,rgba(0,179,255,0) 78%,rgba(0,179,255,0) 100%);
background: -ms-linear-gradient(top,rgba(0,179,255,0) 0%,rgba(0,179,255,0) 75%,#00b3ff 75%,#00b3ff 78%,rgba(0,179,255,0) 78%,rgba(0,179,255,0) 100%);
background: linear-gradient(top,rgba(0,179,255,0) 0%,rgba(0,179,255,0) 75%,#00b3ff 75%,#00b3ff 78%,rgba(0,179,255,0) 78%,rgba(0,179,255,0) 100%);
}
.nav > li > a:hover {
background: none;
}
.btn-info {
border-radius: initial;
background-color: #32b5e5;
padding: 5px 30px;
border: none;
font-size: 14px;
font-weight: 400px;
font-color: #fff;
}
.btn-info:disabled {
background-color: #5b9ec0;
}
.btn-info:active {
background-color: #32b5e5;
}
.panel-heading {
background-color: transparent;
}
.panel-default > .panel-heading {
background-color: transparent;
}
.panel, .panel-group .panel-heading+.panel-collapse>.panel-body {
border: none;
}
.jobs-space {
display: flex;
flex-direction: row;
overflow-y: hidden;
overflow-x: auto;
}
.job-view {
display: flex;
-webkit-display: flex;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-justify-content: flex-start;
justify-content: flex-start;
-webkit-align-content: space-between;
align-content: space-between;
padding-left: 50px;
text-align: left;
}
.job-description {
display: block;
}
.custom-content-tabs[vertical="false"] > ul.nav {
padding-bottom: 1%;
padding-top: 1%;
}
.position-full-description {
margin-top: 50px;
display: flex;
-webkit-display: flex;
flex-direction: column;
-webkit-flex-direction: column;
flex-wrap: nowrap;
-webkit-flex-wrap: nowrap;
text-align: left;
}
.position-full-description > .ng-binding {
display: inline-flex;
-webkit-display: flex;
-webkit-flex-direction: column;
flex-direction: column;
padding-left: 50px;
}
h4.ng-binding:before {
white-space: pre;
display: inline-block;
text-align: left;
}
.detailed_lines {
padding-left: 100px;
}
h5 {
text-align: center;
}
.position-full-description > .ng-binding {
font-style: italic;
}
p.ng-binding {
font-size: 16px;
color: black;
font-weight: 500;
}
#media only screen and (max-width:1000px) {
h4.ng-binding {
white-space: pre;
display: inline-block;
text-align: left;
color: black;
}
}
.container-fluid .nav > li > a {
padding: 20px;
}
.carousel-row {
height: 60px;
overflow-x: scroll;
}
.carousel-dept {
padding: 10vw;
overflow-x: scroll;
}
input[type=text], input[type=email], input[type=text], textarea[type=text] {
border: none;
border-radius: 0;
border-bottom: 1px solid grey;
border-top: none;
border-left: none;
border-right: none;
box-shadow: none;
margin-bottom: 20px;
}
.btn-info {
border-radius: initial;
background-color: #32b5e5;
padding: 5px 30px;
border: none;
}
.btn-info:disabled {
background-color: #5b9ec0;
}
.btn-info:active {
background-color: #32b5e5;
}
.upload {
text-align: left;
margin-left: 15px;
}
input[type=text] {
-moz-appearance: textfield;
}
#unified-inputs.input-group {
width: 100%;
}
#unified-inputs.input-group input:last-of-type {
border-left: 0;
}
.btn-submit {
float: right;
margin-right: 40px;
}
textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="color"]:focus, .uneditable-input:focus {
border-color: rgba(0,0,0,0.8);
box-shadow: 0 1px 1px rgba(255,255,255,0.075) inset,0 0 8px rgba(255,255,255,0.6);
outline: 0 none;
}
.contact-form {
margin-right: 1vw;
}
.add-icon {
position: absolute;
left: 95%;
}
.sub-form {
display: inline-block;
left: 10%;
}
Since it is under job-view class try this on your css
.job-view { width : 100%; }
.job-view p { display : block; overflow-wrap: break-word; max-width : 100%;}
If you also need to apply on your list then also add below code to your css
.job-view ul li {display : block; overflow-wrap: break-word; max-width : 100%;}
add width:100% to p tag and use word-break: break-word or word-break-break-all
.job-view p{
white-space : pre;
}
Tried the above code which works perfectly.

HTML displaying two div's on the same line

Just wondering if anyone can help me to get 1st half and 2nd half on this codepen to display on the same line? I have tried display:inline; however this did not fix the issue.
http://codepen.io/EuanR/pen/BNEBvE
HTML:
<HTML>
<HEAD>
<title>Homepage</title>
</HEAD>
<HEADER>
<H1 id="landingpagelg">Header</H1>
<H2 id="landingpagesm">Sub Header</H2>
</HEADER>
<BODY>
<div class="footerwrapper">
<div class="BFS">
<P>1st half</P>
</div>
<div class="BLFS">
<P>2nd half</P>
</div>
</div>
</script>
</html>
CSS:
a {
text-decoration: none;
}
body {
background-color: #161616;
}
header {
height: 100%;
background-image: url(http://i.imgur.com/11nVLmd.jpg);
background-size: cover;
background-position: center;
margin-bottom: 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
text-align: center
}
#landingpagelg {
font-family: Caviar Dreams;
font-size: 42px;
color: #FFF;
letter-spacing: 1px
}
#landingpagesm {
font-family: Caviar Dreams;
font-size: 21px;
color: #FFF
}
#CMSub {
min-width: 75px;
}
a {
color: #000;
}
a.hover {
color: 0000EE;
}
::selection {
background: #FFB870;
/*#CCCCCC*/
}
::-moz-selection {
background: #FFB870;
}
img::selection {
background: transparent
}
img::-moz-selection {
background: transparent
}
input {
width: 150px;
border: 1px solid;
border-radius: 6px;
height: 25px;
padding: 4px;
}
textarea {
border: 1px solid;
max-width: 500px;
max-height: 250px;
border-radius: 5px;
width: 250px;
height: 125px;
}
#github {
padding-right: 5px;
}
.footerwrapper {
width: 100%;
}
.BFS {
height: 150px;
width: 50%;
background-color: #161616;
}
.BLFS {
height: 150px;
width: 50%;
background-color: #99CCFF;
}
.footerwrapper {
width: 100%;
display:flex;
}
Display Flex solves the issue
.footerwrapper {
width: 100%;
border: 1px solid black;
overflow: hidden;
}
.BFS {
height: 150px;
background-color: #161616;
width: 50%;
float:left; /* add this */
}
.BLFS {
height: 150px;
width: 50%;
background-color: #99CCFF;
float:left; /* add this */
}
Hope this helps
If you don't want to edit your CSS, then simply add the following lines
.footerwrapper {
font-size: 0; /*Removes white space in inline-block elements*/
}
.BFS {
box-sizing: border-box;
display: inline-block;
}
.BLFS {
box-sizing: border-box;
display: inline-block;
}
Make sure you set the font-size in every element that is a child of .footerwrapper
Use
.BFS {float:left;}
.BLFS {float:right;}
Alternatively put the BLFS element first in your HTML and float it to the right. Then the .BFS{float:left;} is unnecessary since it will fill on the left anyway.