Here in my css I have given style padding(1.5rem,3rem,4.5rem,6rem) to its LI's by each nesting, but this is something hard coded, my nesting can go to N numbers, so this approach i can not use, Is there was better approach i can handle this with CSS ?
.parent ul { list-style: none; padding: 0; margin:0 }
li { margin:0; padding: 0; cursor:pointer}
li a {display: block;}
.container ul a {padding-left:1.5rem}
.container ul ul a {padding-left:3rem}
.container ul ul ul a {padding-left:4.5rem}
.container ul ul ul ul a {padding-left:6rem}
li a:hover {
background:green;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div class="container">
<ul class="parent" id="Head">
<li class="items"><a><span>AAA</span></a></li>
<li class="items">
<div class="group"><a><span>BBBB</span></a> </div>
<ul class="group-item">
<li class="items"><a><span>bbbbb</span></a></li>
<li class="items"><a><span>bbbbb</span></a></li>
</ul>
</li>
<li class="items">
<div class="group"><a><span>CCCC</span></a></div>
<ul class="group-item">
<li class="items"><a><span>cccc</span></a></li>
<li class="items"><a><span>cccc</span></a></li>
<li class="items">
<div class="group"> <a><span>cccc</span></a> </div>
<ul class="group-item">
<li class="items"><a><span>cccc1</span></a></li>
<li class="items"><a><span>cccc1</span></a></li>
<li class="items">
<div class="group"> <a><span>cccc1</span></a> </div>
<ul class="group-item">
<li class="items"><a><span>cccc2</span></a></li>
<li class="items"><a><span>cccc2</span></a></li>
<li class="items"><a><span>cccc2</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</div>
</body>
</html>
Looks Only solution left is using javascript
var parents = document.getElementsByClassName('parent');
var allUls= parents[0].querySelectorAll('ul');
allUls.forEach(function(x,i){
var i = i+1;
var y = x.querySelectorAll('.sid');
y.forEach(function(x1){
x1.style.paddingLeft = 1.5 * i+'rem';
})
})
ul { list-style: none; padding: 0; margin:0 }
li { margin:0; padding: 0; cursor:pointer}
li a {display: block;}
li a:hover {
background:red;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div class="container">
<ul class="parent" id="Head">
<li class="items"><a class="sid"><span>A</span></a></li>
<li class="items">
<div class="group"><a class="sid"><span>B</span></a> </div>
<ul class="group-item">
<li class="items"><a class="sid"><span>b</span></a></li>
<li class="items"><a class="sid"><span>b</span></a></li>
</ul>
</li>
<li class="items">
<div class="group"><a class="sid"><span>C</span></a></div>
<ul class="group-item">
<li class="items"><a class="sid"><span>c</span></a></li>
<li class="items"><a class="sid"><span>c</span></a></li>
<li class="items">
<div class="group"> <a class="sid"><span>c</span></a> </div>
<ul class="group-item">
<li class="items"><a class="sid"><span>c1</span></a></li>
<li class="items"><a class="sid"><span>c1</span></a></li>
<li class="items">
<div class="group"> <a class="sid"><span>c1</span></a> </div>
<ul class="group-item">
<li class="items"><a class="sid"><span>c2</span></a></li>
<li class="items"><a class="sid"><span>c2</span></a></li>
<li class="items"><a class="sid"><span>c2</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</div>
</body>
</html>
Related
I want add all nested li's content(anchor tag) to some dynamic padding-left,
Right now with Css I can add something like this to achieve but this looks like hard coded,
.container ul li a {padding-left:1rem}
.container ul ul li a {padding-left:2rem}
.container ul ul ul li a {padding-left:3rem}
.container ul ul ul ul li a {padding-left:4rem}
each nested li's .sid class should have 1rem * its nested depth,
I want to add this to N number of nested li's
Can this be done by CSS ? I was thinking only JS is the final solution here ?
ul { list-style: none; padding: 0; margin:0 }
li { margin:0; padding: 0; cursor:pointer}
li a {display: block;}
li a:hover {
background:green;
}
.container ul li a {padding-left:1rem}
.container ul ul li a {padding-left:2rem}
.container ul ul ul li a {padding-left:3rem}
.container ul ul ul ul li a {padding-left:4rem}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div class="container">
<ul class="parent" id="Head">
<li class="items"><a class="sid"><span>A</span></a></li>
<li class="item">
<div class="group"><a class="sid"><span>B</span></a> </div>
<ul class="group-item">
<li class="items"><a class="sid"><span>b</span></a></li>
<li class="items"><a class="sid"><span>b</span></a></li>
</ul>
</li>
<li class="item">
<div class="group"><a class="sid"><span>C</span></a></div>
<ul class="group-item">
<li class="items"><a class="sid"><span>c</span></a></li>
<li class="items"><a class="sid"><span>c</span></a></li>
<li class="item">
<div class="group"> <a class="sid"><span>c</span></a> </div>
<ul class="group-item">
<li class="items"><a class="sid"><span>c1</span></a></li>
<li class="items"><a class="sid"><span>c1</span></a></li>
<li class="item">
<div class="group"> <a class="sid"><span>c1</span></a> </div>
<ul class="group-item">
<li class="items"><a class="sid"><span>c2</span></a></li>
<li class="items"><a class="sid"><span>c2</span></a></li>
<li class="items"><a class="sid"><span>c2</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</div>
</body>
</html>
This should be your solution.
I think I understood your question now.
"sid" classes are not related to each other that's why they don't add up. You need to create sub-classes. I hope this is possible in your case otherwise I'd recommend using jQuery.
ul { list-style: none; padding: 0; margin:0 }
li { margin:0; padding: 0; cursor:pointer}
li a {display: block;}
li a:hover {
background:green;
}
.group-item .sid {
padding-left: 1rem;
}
.sub-group-item .sid {
padding-left: 2rem;
}
.sub2-group-item .sid {
padding-left: 3rem;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div class="container">
<ul class="parent" id="Head">
<li class="item"><a class="sid"><span>A</span></a></li>
<li class="item">
<div class="group"><a class="sid"><span>B</span></a> </div>
<ul class="group-item">
<li class="items"><a class="sid"><span>b</span></a></li>
<li class="items"><a class="sid"><span>b</span></a></li>
</ul>
</li>
<li class="item">
<div class="group"><a class="sid"><span>C</span></a></div>
<ul class="group-item">
<li class="items"><a class="sid"><span>c</span></a></li>
<li class="items"><a class="sid"><span>c</span></a></li>
<li class="item">
<div class="group"> <a class="sid"><span>c</span></a> </div>
<ul class="sub-group-item">
<li class="items"><a class="sid"><span>c1</span></a></li>
<li class="items"><a class="sid"><span>c1</span></a></li>
<li class="item">
<div class="group"> <a class="sid"><span>c1</span></a> </div>
<ul class="sub2-group-item">
<li class="items"><a class="sid"><span>c2</span></a></li>
<li class="items"><a class="sid"><span>c2</span></a></li>
<li class="items"><a class="sid"><span>c2</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</div>
</body>
</html>
I'm trying to float a ul inside a div and nothing seems to be working. Am I missing something?
Is there a problem with me using flexbox? I've tried different selectors like .menu ul{} and have given the ul a class but nothing seems to be working.
I have also tried to get rid of the div elements nested inside the ul, but that didn't fix the problem.
Tried assigning a display: block to the menu div as well as a height and width but that didn't do anything.
I'm sure there is something obvioues that I'm missing but I can't figure it out.
Thanks a lot!
$primaryColor: #75beff;
$secondaryColor: #7c3702;
*{
box-sizing: border-box;
}
body {
margin: 0;
height:100%;
font-family: 'Roboto', sans-serif;
}
ul {
list-style: none;
}
.header {
background: $primaryColor;
display: flex;
justify-content: space-between;
align-items: center;
height: 100%;
width: 100%;
overflow: hidden;
}
.menu-list {
float: left;
}
.drop-down{
visibility: hidden;
overflow: hidden;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/main.css">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<title>Ecommerce website</title>
</head>
<body>
<div class="header">
<div class="logo"><span class="logo-text">My Fabulous store</span>
</div>
<div class="menu">
<ul class="menu-list">
<li class="main-categ">Femei</li>
<div class="drop-down">
<ul>
<li class="list-item">Item 1</li>
<li class="list-item">Item 2</li>
<li class="list-item">Item 3</li>
</ul>
</div>
<li class="main-categ">Barbati</li>
<div class="drop-down">
<ul>
<li class="list-item">Item 1</li>
<li class="list-item">Item 2</li>
<li class="list-item">Item 3</li>
</ul>
</div>
<li class="main-categ">Copii</li>
<div class="drop-down">
<ul>
<li class="list-item">Item 1</li>
<li class="list-item">Item 2</li>
<li class="list-item">Item 3</li>
</ul>
</div>
<li class="main-categ">Altele</li>
<div class="drop-down">
<ul>
<li class="list-item">Item 1</li>
<li class="list-item">Item 2</li>
<li class="list-item">Item 3</li>
</ul>
</div>
</ul>
</div>
<div class="icons">
<a href="#!">
<i class="fab fa-twitter fa-2x"></i>
</a>
<a href="#!">
<i class="fab fa-facebook fa-2x"></i>
</a>
<a href="#!">
<i class="fab fa-linkedin fa-2x"></i>
</a>
</div>
</div>
<div class="main">
</div>
<div class="footer">
</div>
</body>
</html>
#K.C. and #MarsAndBlack have given the right solutions:
If you just want the list inside, then ignore the last comment and try .menu-list { display: flex; align-self: flex-start;}
The problem was mixing floats and flex.
Thank you all for your help
I have 5 side by side lists in my website's footer as follows:
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
What I would like to happen is that at any resolution below 992px, the lists will each take up 50% of the column creating 3 rows of 2 lists each except for the last (since I have 5 lists)
Here is my sass code: (maxMQ is just a mixin for a media query and $md-max-width is 992px)
.footer {
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
#include maxMQ($md-max-width) {
margin-top: 30px;
width: 50%;
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
a {
color: #ffffff;
text-decoration: none;
cursor: pointer;
}
}
}
The problem is that when I reduce resolution below 992px (mobile/tablet), the 3rd list skips a spot on the second row. so it looks something like this:
row 1: list list
row 2: list
row 3: list list
What I want is:
row 1: list list
row 2: list list
row 3: list
I have no idea why this is happening. I do know that when I remove the ul's from within the 'links' divs it works fine.
Any help would be greatly appreciated! Thanks!
This is due to the floating elements, the first element has more height than the second one and it's creating this issue on the second row.
To fix this and you can use flex and remove the floating:
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.footer-links {
display: flex;
flex-wrap:wrap;
}
.links {
margin-top: 30px;
width: 50%;
float: none;
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
Or simply remove floating without adding flex but you need to fix white spaces issue to have them 50% width:
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.footer-links {
font-size: 0; /* remove white spaces */
}
.links {
margin-top: 30px;
width: 50%;
float: none;
font-size: initial; /* put back font as initial*/
vertical-align:top;
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
Or you can simply add a min-height to your elements to be sure they have the same height:
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.links {
margin-top: 30px;
width: 50%;
min-height:170px; /* adjust this value with want you what*/
}
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
Another easy fix for your situation is to clear floating after each last element of each row by using clear:left (but you need to adjust this if you change your logic, for example 3 per row instead of 2 per row):
.links {
float: left;
display: inline-block;
width: calc(100% / 5);
}
#media all and (max-width:992px) {
.links {
margin-top: 30px;
width: 50%;
}
/* Added this code*/
.links:nth-child(2n+1) {
clear:left;
}
/**/
.title {
font-size: 14px;
margin-bottom: 5px;
padding-bottom: 7px;
display: inline-block;
border-bottom: 2px solid $highlight-blue;
}
ul {
margin: 0;
padding: 0;
display: block;
}
li {
margin-top: 5px;
font-size: 13px;
}
li a {
color: #000 text-decoration: none;
cursor: pointer;
}
}
<div class="row">
<div class="col-xs-12 footer-links">
<div class="links">
<h1 class="title">ABOUT US</h1>
<ul>
<li class="link"> About Company</li>
<li class="link"> Legal Documents</li>
<li class="link"> Careers</li>
<li class="link"> Contact Us</li>
<li class="link"> FAQs</li>
</ul>
</div>
<div class="links">
<h1 class="title">ACCOUNTS</h1>
<ul>
<li class="link">Register</li>
<li class="link">Compare Account Types</li>
<li class="link">Funding Options</li>
<li class="link">Islamic Account</li>
</ul>
</div>
<div class="links">
<h1 class="title">INSTRUMENTS</h1>
<ul>
<li class="link"> Currencies</li>
<li class="link"> Commodities</li>
<li class="link"> Metals</li>
<li class="link"> Shares</li>
<li class="link"> Bonds</li>
<li class="link"> Indices</li>
</ul>
</div>
<div class="links">
<h1 class="title">PLATFORMS</h1>
<ul>
<li class="link"> Meta Trader 4</li>
<li class="link"> MT4 Desktop</li>
<li class="link"> MT4 iOS</li>
<li class="link"> MT4 Android</li>
<li class="link"> MT4 Webtrader</li>
</ul>
</div>
<div class="links">
<h1 class="title">TRADING TOOLS</h1>
<ul>
<li class="link"> Expiration Dates</li>
<li class="link"> Market Hours</li>
<li class="link"> Holiday Calendar</li>
<li class="link"> Economic Calendar</li>
</ul>
</div>
</div>
inline-block automatically adds some margin to the elements, I believe around 4px. So 50% plus that 4px will make it more than 100%, pushing down the elements. Try changing to just block instead.
I have a div like below i need to align the 3 ul which is inside the li in single row using css.
<div id="printEmilCountDiv" >
<li id="reports-print-email-count">
<ul id="reports-print-email-count-container">
<li>Print count:</li>
<li id="printCount"></li>
</ul>
<ul >
<li>Email count:</li>
<li id="emailCount"></li>
</ul>
<ul >
<li>Other count:</li>
<li id="otherCount"></li>
</ul>
</li>
</div>
As like this
try to this code
#printEmilCountDiv, #printEmilCountDiv *{
list-style-type:none;
margin:0;padding:0;
}
#printEmilCountDiv ul{display:inline-block;vertical-align:top; border:solid 1px red;}
<ul id="printEmilCountDiv" >
<li id="reports-print-email-count">
<ul id="reports-print-email-count-container">
<li>Print count:</li>
<li id="printCount">po</li>
</ul>
<ul >
<li>Email count:</li>
<li id="emailCount">ec</li>
</ul>
<ul >
<li>Other count:</li>
<li id="otherCount"oc>oc</li>
</ul>
</li>
</ul>
Or this like
#printEmilCountDiv, #printEmilCountDiv *{
list-style-type:none;
margin:0;padding:0;
}
#printEmilCountDiv ul{display:inline-block;vertical-align:top; border:solid 1px red;}
#printEmilCountDiv ul li{display:inline-block;vertical-align:top;}
<ul id="printEmilCountDiv" >
<li id="reports-print-email-count">
<ul id="reports-print-email-count-container">
<li>Print count:</li>
<li id="printCount">po</li>
</ul>
<ul >
<li>Email count:</li>
<li id="emailCount">ec</li>
</ul>
<ul >
<li>Other count:</li>
<li id="otherCount"oc>oc</li>
</ul>
</li>
</ul>
You may remove the first li and replace it with div. Then apply a styling like;
ul{
margin-top: 0;
margin-bottom: 0;
}
Which trims the margin. Here is a demo
And you may add float: left; to either ul or li to align them in a row, like this
I am building a site for my school's robotics team. This is my first time ever coding in html/css. For some reason, my other pages use the margins quite nicely, but for this page specifically, my "margin-right" element does not work.
<!DOCTYPE>
<html>
<head>
<link rel="stylesheet" type="text/css" href="index_style.css">
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<title>Team 3774 Homepage</title>
</head>
<body>
<div id="page">
<div class="Banner">
<a class="Banner_Link" href="www.robotichive3774.com">
<img src="/Images/Banner.png" height="200" width="1350" border="0">
</a>
</div>
<div class="navbar">
<ul class="nav">
<li><a class="li_nav" href="/Home">Home</a></li>
<li><a class="li_nav" href="/Team Bio">Team Bio</a></li>
<li><a class="li_nav" href="/Our Robot">Our Robot</a></li>
<li><a class="li_nav" href="/Our Coach">Our Coach</a></li>
<li><a class="li_nav" href="/Gallery">Gallery</a></li>
<li><a class="li_nav" href="/Outreach">Outreach</a></li>
<li><a class="li_nav" href="/Youtube">Youtube</a></li>
</ul>
</div>
<div class="Team_Bio">
<div class="example">
<h2>Team Bio</h2>
<h1>Example</h1>
<ul>
<li class="li_info">Class</li>
<li class="li_info">Role</li>
<li class="li_info">Career Interests</li>
<li class="li_info">Other Clubs and Sports</li>
</ul>
</div>
<div class="Abanoub_Boules">
<div class="info_AB">
<h1>Abanoub Boules</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Captian, Coder, Documenter</li>
<li class="li_info">CEO of a Biology Firm</li>
<li class="li_info">Coptic Society</li>
<li class="li_info">Technology Student Association</li>
<li class="li_info">President of Stem Clubs</li>
</ul>
</div>
<div class="picture_AB">
<img src="Abanoub.jpg" width="350px" height="350px">
</div>
</div>
<div class="Andre_Bernardo">
<div class="info_ABe">
<h1>Andre Bernardo</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Engineer, 3D modeling</li>
<li class="li_info">Computer Science</li>
<li class="li_info">Tennis</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_ABe">
<img src="Andre.jpg" width="350px" height="350px">
</div>
</div>
<div class="Leo_Scarano">
<div class="info_LS">
<h1>Leo Scarano</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Engineer, Coder</li>
<li class="li_info">Computer Science</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_LS">
<img src="Leo.jpg" width="350px" height="350px">
</div>
</div>
<div class="Mina_Hanna">
<div class="info_MH">
<h1>Mina Hanna</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Engineer, Coder</li>
<li class="li_info">Pharmaceutics</li>
<li class="li_info">Coptic Society</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_MH">
<img src="Mina.jpg" width="350px" height="350px">
</div>
</div>
<div class="Kenneth_Rebbecke">
<div class="info_KR">
<h1>Kenneth Rebbecke</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Engineer, Documenter</li>
<li class="li_info">Structual Engineering</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_KR">
<img src="Kenny.jpg" width="350px" height="350px">
</div>
</div>
<div class="Kristen_Kaldas">
<div class="info_KK">
<h1>Kristen Kaldas</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Coder, Bookkeeper</li>
<li class="li_info">Biomedical Engineering</li>
<li class="li_info">Science Seminar</li>
<li class="li_info">Science Club</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_KK">
<img src="Kristen.jpg" width="350px" height="350px">
</div>
</div>
<div class="Melanie_Aguilar">
<div class="info_MA">
<h1>Melanie Aguilar</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Secratary, Mascot</li>
<li class="li_info">Party Planner</li>
<li class="li_info">Yearbook</li>
</ul>
</div>
<div class="picture_MA">
<img src="Melanie.jpg" width="350px" height="350px">
</div>
</div>
<div class="Anish_Patel">
<div class="info_AP">
<h1>Anish Patel</h1>
<ul>
<li class="li_info">Junior</li>
<li class="li_info">Engineer, 3d modeling</li>
<li class="li_info">Mechanical Engineer</li>
<li class="li_info">Science Club</li>
<li class="li_info">Junior Classical League</li>
<li class="li_info">Certamn</li>
</ul>
</div>
<div class="picture_AP">
<img src="Anish.jpg" width="350px" height="350px">
</div>
</div>
<div class="Furhan_Ashraf">
<div class="info_FA">
<h1>Furhan Ashraf</h1>
<ul>
<li class="li_info">Junior</li>
<li class="li_info">Financial Advisor, Engineer</li>
<li class="li_info">Engineering/Undecided</li>
<li class="li_info">Science Club</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_FA">
<img src="Furhan.jpg" width="350px" height="350px">
</div>
</div>
<div class="Andrew_W">
<div class="info_AW">
<h1>Andrew Wojtkowski</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Engineer, 3d Modeling</li>
<li class="li_info">Aerospace Engineer</li>
<li class="li_info">Varsity Hockey</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_AW">
<img src="Andrew.jpg" width="350px" height="350px">
</div>
</div>
<div class="Bryan_F">
<div class="info_BF">
<h1>Bryan Ferreira</h1>
<ul>
<li class="li_info">Senior</li>
<li class="li_info">Engineer, Documenter</li>
<li class="li_info">Computer Engineer/Civil Engineer</li>
<li class="li_info">Guitar</li>
<li class="li_info">Technology Student Association</li>
</ul>
</div>
<div class="picture_BF">
<img src="Bryan.jpg" width="350px" height="350px">
</div>
</div>
</div>
</div>
</body>
</html>
CSS
.Team_Bio
{
margin-left: 200px;
margin-right: 200px;
}
a.Banner_Link
{
padding:0 !important;
}
.Banner
{
height: 200px;
width: 1350px;
}
#page{
width: 1000px;
margin-left: 0px;
margin-right: 0px;
}
div
{
font-family: 'Roboto Slab', serif;
}
.body
{
margin-left: 200px;
margin-right: 200px;
margin-top: 50px;
margin-bottom: 100px;
}
.Banner img
{
vertical-align:top;
}
body
{
margin: 0;
}
.li_nav
{
float: left;
display:inline-block;
font-family: 'Roboto Slab', serif;
}
.nav
{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
min-width: 1350px;
}
a:link, a:visited
{
display:inline-block;
width: 182.7px;
padding-top: 12px;
padding-right: 5px;
padding-bottom: 14px;
padding-left: 5px;
font-weight: bold;
color: #FFFFFF;
background-color: #990000;
text-align: center;
text-decoration: none;
font-family: 'Roboto Slab', serif;
}
a:hover, a:active
{
background-color: #B20000;
}
.Team_Bio
{
min-width: 1350px;
}
h2
{
font-size: 60px;
text-align: center;
}
.example
{
float: left;
width: 1350px;
height: 425px;
margin: 0 auto;
}
.Abanoub_Boules
{
float: left;
width: 1350px;
height: 500px;
margin: 0 auto;
}
The site is robotichive3774.com if you want to see exactly what I am talking about.
It's true, the HTML and CSS are a mess but as you said you're new to this.
The layout problem has to do with the widths of your team member sections inside that element. They're forcing it to stretch out.
I'd recode the CSS for the team members.
Start by removing the pixels widths on each team member's and set them to percentage based widths.
Make the team member's main element 100% wide so it just fills the container it's sitting in.
Then set their info and picture wrapping elements to 49% each.
Set the image inside the picture wrapping element to 100% and auto for the height.
Do all these widths etc in your CSS file.
That should fix you right up.
Lastly, if you're gonna do the floats put a "clearing div" after each team member so the next section if forced below the previous run. Otherwise things will run into each other.
Like this:
<div class="clear"></div>
.clear { clear: both; }
In the end, you should really simply your code. There's too many classes etc. All the team member sections could have the same class so you can apply global rules etc.