Adding navbar to centred elements using display property - html

I am trying to centre and overall set elements using css display property but i encountered a problem.
Once i added a navbar as an element whole structure got changed it's place.
Here is the code before i added navbar:
body {
display: flex;
justify-content: center;
}
.content {
display: inline-flex;
width: 600px;
height: 100%;
border-width: 1px;
justify-content: center;
}
.nav {
width: 100%;
height: 100px;
border-width: 1px;
background-color: #000000;
display: block;
}
.menu {
display: inline-block;
width: 200px;
height: 100%;
background-color: #3F4E62;
}
.article {
display: inline-block;
width: 380px;
height: 100%;
background-color: #dddddd;
}
.item{
color: #FFFFFF;
font-family: Georgia;
display: block;
}
<div class="content"><div class="menu"><a class="item">MENU ITEM</a><a class="item">MENU ITEM</a><a class="item">MENU ITEM</a></div><div class="article">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean iaculis non eros pellentesque
commodo. Phasellus elit mauris, ultricies ac sem volutpat, efficitur convallis nibh. Mauris rutrum
odio nec justo rutrum, sit amet tristique sapien tristique. Nullam ac urna eget tortor suscipit blandit.
Maecenas pharetra faucibus odio quis feugiat. Curabitur a commodo arcu, a pellentesque lorem.
Nulla facilisi. Nullam augue metus, scelerisque sed pulvinar at, fermentum sit amet arcu. Morbi
lobortis suscipit porttitor. In vel tristique lorem, vitae pulvinar sapien. Nullam pretium imperdiet
nibh, eu bibendum arcu egestas ac. Vestibulum faucibus fringilla justo. Nam facilisis
elementum ex, ut fermentum leo feugiat vulputate. Ut molestie, enim ac faucibus mollis, est turpis
varius lectus, at sollicitudin erat ligula vitae tortor. Ut tincidunt sed sem in sodales. Cras tincidunt
ligula diam, quis volutpat quam cursus nec.
</div></div>
Navbar was supposed to be a line across whole window but it got stuck inline with elements from div with class="content".
Here is the code when i added navbar:
body {
display: flex;
justify-content: center;
}
.content {
display: inline-flex;
width: 600px;
height: 100%;
border-width: 1px;
justify-content: center;
}
.nav {
width: 100%;
height: 100px;
border-width: 1px;
background-color: #000000;
display: block;
}
.menu {
display: inline-block;
width: 200px;
height: 100%;
background-color: #3F4E62;
}
.article {
display: inline-block;
width: 380px;
height: 100%;
background-color: #dddddd;
}
.item{
color: #FFFFFF;
font-family: Georgia;
display: block;
}
<div class="nav">Navbar</div>
<div class="content"><div class="menu"><a class="item">MENU ITEM</a><a class="item">MENU ITEM</a><a class="item">MENU ITEM</a></div><div class="article">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean iaculis non eros pellentesque
commodo. Phasellus elit mauris, ultricies ac sem volutpat, efficitur convallis nibh. Mauris rutrum
odio nec justo rutrum, sit amet tristique sapien tristique. Nullam ac urna eget tortor suscipit blandit.
Maecenas pharetra faucibus odio quis feugiat. Curabitur a commodo arcu, a pellentesque lorem.
Nulla facilisi. Nullam augue metus, scelerisque sed pulvinar at, fermentum sit amet arcu. Morbi
lobortis suscipit porttitor. In vel tristique lorem, vitae pulvinar sapien. Nullam pretium imperdiet
nibh, eu bibendum arcu egestas ac. Vestibulum faucibus fringilla justo. Nam facilisis
elementum ex, ut fermentum leo feugiat vulputate. Ut molestie, enim ac faucibus mollis, est turpis
varius lectus, at sollicitudin erat ligula vitae tortor. Ut tincidunt sed sem in sodales. Cras tincidunt
ligula diam, quis volutpat quam cursus nec.
</div></div>

Leave the body tag and add another div class="main-container"> name it whatever you want with the following style. You're missing the flex-flow: or flex-wrap so the elements are not wrapping and you basically need them to wrap.
.main-container {
display: flex;
flex-flow: row wrap;
justify-content: center;
}
Here check this:
.main-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.content {
display: inline-flex;
width: 600px;
height: 100%;
border-width: 1px;
justify-content: center;
}
.nav {
width: 100%;
height: 100px;
border-width: 1px;
background-color: #000000;
display: block;
}
.menu {
display: inline-block;
width: 200px;
height: 100%;
background-color: #3f4e62;
}
.article {
display: inline-block;
width: 380px;
height: 100%;
background-color: #dddddd;
}
.item {
color: #ffffff;
font-family: Georgia;
display: block;
}
<div class="main-container">
<div class="nav">Navbar</div>
<div class="content">
<div class="menu"><a class="item">MENU ITEM</a><a class="item">MENU ITEM</a><a class="item">MENU ITEM</a></div>
<div class="article">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean iaculis non eros pellentesque commodo. Phasellus elit mauris, ultricies ac sem volutpat, efficitur convallis nibh. Mauris rutrum odio nec justo rutrum, sit amet tristique sapien tristique.
Nullam ac urna eget tortor suscipit blandit. Maecenas pharetra faucibus odio quis feugiat. Curabitur a commodo arcu, a pellentesque lorem. Nulla facilisi. Nullam augue metus, scelerisque sed pulvinar at, fermentum sit amet arcu. Morbi lobortis suscipit
porttitor. In vel tristique lorem, vitae pulvinar sapien. Nullam pretium imperdiet nibh, eu bibendum arcu egestas ac. Vestibulum faucibus fringilla justo. Nam facilisis elementum ex, ut fermentum leo feugiat vulputate. Ut molestie, enim ac faucibus
mollis, est turpis varius lectus, at sollicitudin erat ligula vitae tortor. Ut tincidunt sed sem in sodales. Cras tincidunt ligula diam, quis volutpat quam cursus nec.
</div>
</div>
</div>

Related

Making outer columns of flexbox sticky

I have content on page and I would like to make both sidebars to be sticky, something like:
I am using flex:
<div className="homePageFeed">
<div className="homePageFeedWrapper">
<HomePageFeedMenu/>
<HomePageFeedContent/>
<HomePageFeedUtil/>
</div>
</div>
.homePageFeed{
position: relative;
width: 100%;
}
.homePageFeedWrapper{
display: flex;
align-items: center;
position: relative;
height: 100%;
padding-left: 22px;
padding-right: 16px;
z-index: 30;
flex-direction: row;
}
Other components, left-sidebar:
const HomePageFeedMenu = () => {
return (
<div className="homeFeedMenu">
<ol>
<li> Mammals</li>
<li> Lizards</li>
<li> Birds</li>
<li> Spiders</li>
</ol>
</div>
)
}
export default HomePageFeedMenu;
.homeFeedMenu{
flex: 10 0 0;
width: 100%;
height: 500px;
border-right: 1px solid hsl(210,8%,35%);
}
ol{
list-style: none;
}
li{
color: hsl(210,8%,35%);
margin: 0;
}
Scrollable content ( with test item in it ):
const HomePageFeedContent = () => {
return (
<div className="homeFeedContent">
<div className="homeFeedItem">
<div className="content">
<div className="homeFeedItemTitle"><p>Animal name</p></div>
<div className="homeFeedItemContent">
Animal description
</div>
<div className="homeFeedItemMetaInfo">Age and adoption info</div>
</div>
<div className="img">Animal picture</div>
</div>
</div>
)
}
.homeFeedContent{
padding-top: 25px;
flex: 70 0 0;
width: 100%;
border-right: 1px solid hsl(210,8%,35%);
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.homeFeedItem{
width: 90%;
height: 200px;
display: flex;
margin-top:25px;
flex-direction: row;
justify-content: center;
border-bottom: 1px solid hsl(210,8%,35%);;
}
.content{
flex: 80 80 0;
display: flex;
flex-direction: column;
}
.img{
flex: 20 20 0;
width: 100%;
height: 100%;
border: 1px solid black;
}
.homeFeedItemTitle{
width: 100%;
flex: 20 20 0;
}
.homeFeedItemContent{
width: 100%;
flex: 60 60 0;
border-bottom: 1px hsl(210,8%,35%);;
}
.homeFeedItemMetaInfo{
width: 100%;
flex: 20 20 0;
}
export default HomePageFeedContent;
And right static sidebar
const HomePageFeedUtil = () => {
return (
<div className="homeFeedUtil">
</div>
)
}
export default HomePageFeedUtil;
.homeFeedUtil{
flex: 20 0 0;
width: 100%;
height: 500px;
}
Now I am trying to use sticky positioning for both sidebars, however, it does not work as they are part of the flexbox. I would also like to fix their height, as you can see I attempted to use 500px, hover when the middle flex element gets lots of element and the site become scrollable, it readjusts the position of both sidebars ( as they have fixed height ) and thus their content does not appear on top of it "column".
Are there any tricks to use both, flex and sticky positioning? Or do I need to do it without flex?
Thanks for the help!
I'd not use flexbox. I'd use position: sticky for the top then position: fixed for each sidebar. Use css variables to work out the width of the scrollable area. Here's an example:
body {
box-sizing: border-box;
margin: 0;
}
.main-container {
--header-height: 50px;
--header-gap: 0.5rem;
--sidebar1-width: 200px;
--sidebar2-width: 100px;
--sidebar-gap: 0.5rem;
}
.sticky-header {
position: sticky;
height: var(--header-height);
background-color: lightblue;
border: 1px solid blue;
top: 0;
z-index: 1;
}
.sticky-sidebar1 {
position: fixed;
top: var(--header-height);
left: 0;
width: var(--sidebar1-width);
height: calc(100vh - var(--header-height));
background-color: lightgreen;
border: 1px solid darkgreen;
}
.sticky-sidebar2 {
position: fixed;
top: var(--header-height);
right: 0;
width: var(--sidebar2-width);
height: calc(100vh - var(--header-height));
background-color: lightpink;
border: 1px solid darkred;
}
.scrollable-content {
border: 1px solid red;
padding: 0.25rem;
overflow: hidden;
margin-left: calc(var(--sidebar1-width) + var(--sidebar-gap));
margin-right: calc(var(--sidebar2-width) + var(--sidebar-gap));
margin-top: var(--header-gap);
}
#media only screen and (max-width: 600px) {
.main-container {
--sidebar1-width: 100px;
--sidebar2-width: 0px;
}
}
<div class='main-container'>
<div class="sticky-header">Sticky Header</div>
<div class="sticky-sidebar1">Sticky Sidebar1</div>
<div class="sticky-sidebar2">Sticky Sidebar2</div>
<div class="scrollable-content">
<h1>Scrollable Content</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. In eu mi bibendum neque egestas congue quisque egestas. Adipiscing enim eu turpis egestas
pretium.
Accumsan sit amet nulla facilisi morbi tempus iaculis urna id. In massa tempor nec feugiat nisl. Mattis nunc
sed
blandit libero volutpat sed. Magna ac placerat vestibulum lectus mauris ultrices eros in. Senectus et netus et
malesuada fames ac turpis egestas. Tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada. Vel elit
scelerisque mauris pellentesque pulvinar. Egestas egestas fringilla phasellus faucibus scelerisque eleifend
donec pretium. Tristique risus nec feugiat in fermentum posuere urna nec tincidunt. Lectus vestibulum mattis
ullamcorper velit sed. Risus ultricies tristique nulla aliquet enim tortor at auctor. Vitae congue mauris
rhoncus aenean vel elit scelerisque mauris pellentesque. Lacus suspendisse faucibus interdum posuere lorem
ipsum
dolor. Suspendisse interdum consectetur libero id. Vestibulum lorem sed risus ultricies tristique nulla
aliquet.
Nunc eget lorem dolor sed viverra ipsum nunc. Diam sit amet nisl suscipit adipiscing bibendum est.
Diam phasellus vestibulum lorem sed risus ultricies tristique. Ultrices sagittis orci a scelerisque. Iaculis
at
erat pellentesque adipiscing commodo elit at imperdiet dui. Donec enim diam vulputate ut pharetra sit.
Fringilla
urna porttitor rhoncus dolor purus. Turpis massa tincidunt dui ut ornare lectus. Et netus et malesuada fames
ac
turpis egestas maecenas pharetra. Malesuada nunc vel risus commodo viverra maecenas. Purus sit amet volutpat
consequat mauris nunc. Vel fringilla est ullamcorper eget nulla. Duis ultricies lacus sed turpis tincidunt id
aliquet risus. Arcu ac tortor dignissim convallis aenean et. Elementum nibh tellus molestie nunc non blandit
massa.
Magna sit amet purus gravida quis. Amet tellus cras adipiscing enim eu turpis egestas pretium aenean. Sagittis
nisl rhoncus mattis rhoncus urna neque. Feugiat scelerisque varius morbi enim nunc faucibus. Parturient montes
nascetur ridiculus mus mauris vitae ultricies leo. Enim nulla aliquet porttitor lacus luctus accumsan tortor
posuere. Rhoncus aenean vel elit scelerisque mauris pellentesque. Velit aliquet sagittis id consectetur purus.
Id porta nibh venenatis cras sed felis eget velit aliquet. Mattis nunc sed blandit libero. Suspendisse in est
ante in. Duis at tellus at urna condimentum mattis. Consequat semper viverra nam libero justo laoreet sit amet
cursus.
Sed turpis tincidunt id aliquet risus feugiat. Aliquam purus sit amet luctus. Suspendisse faucibus interdum
posuere lorem. Cursus turpis massa tincidunt dui ut ornare. Donec ultrices tincidunt arcu non sodales. Tellus
integer feugiat scelerisque varius morbi enim nunc faucibus. Leo integer malesuada nunc vel risus. Ut pharetra
sit amet aliquam id diam. Condimentum vitae sapien pellentesque habitant morbi tristique. Vestibulum lectus
mauris ultrices eros. Aenean sed adipiscing diam donec adipiscing tristique risus. Nulla aliquet porttitor
lacus
luctus accumsan tortor. Semper feugiat nibh sed pulvinar. Placerat in egestas erat imperdiet sed.
Pulvinar pellentesque habitant morbi tristique senectus et netus. Vitae turpis massa sed elementum tempus
egestas sed. Aliquam sem et tortor consequat id porta nibh venenatis cras. Orci dapibus ultrices in iaculis
nunc
sed augue lacus. Blandit turpis cursus in hac habitasse platea. Volutpat blandit aliquam etiam erat velit
scelerisque. Massa ultricies mi quis hendrerit dolor magna eget est lorem. Lectus sit amet est placerat. Eu mi
bibendum neque egestas congue. Dictum non consectetur a erat nam at. Facilisis magna etiam tempor orci eu
lobortis. Sit amet venenatis urna cursus eget nunc. Sed risus pretium quam vulputate dignissim suspendisse.
Vivamus at augue eget arcu dictum. Ultricies tristique nulla aliquet enim tortor. Gravida neque convallis a
cras
semper auctor neque.
Malesuada pellentesque elit eget gravida cum sociis natoque penatibus. Est lorem ipsum dolor sit amet. Tempor
orci dapibus ultrices in iaculis nunc. Lorem ipsum dolor sit amet consectetur adipiscing. Volutpat diam ut
venenatis tellus in metus vulputate eu. Sed nisi lacus sed viverra tellus. Penatibus et magnis dis parturient.
Ipsum consequat nisl vel pretium lectus quam. Mollis aliquam ut porttitor leo a diam. Cras sed felis eget
velit.
Euismod lacinia at quis risus. Neque viverra justo nec ultrices dui. Pellentesque habitant morbi tristique
senectus et netus et. Pharetra vel turpis nunc eget lorem dolor. Ac auctor augue mauris augue neque gravida
in.
</p>
</div>
</div>
For the result you are looking for you would need to use position: fixed; in your css for all 3 elements you want to be fixed;
For your top header it would be something like:
#enterIDhere {
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
margin: 0 auto;
}
For your left sidebar it would be something like:
#EnterIDhere {
position: fixed;
left: 0;
bottom: 0;
}
and last but not least your right sidebar would need something like:
#EnterIDhere {
position: fixed;
right: 0;
bottom: 0;
}

How do I position a <img> in-between two <ul> in a navigation bar?

I'm trying to create a navigation bar at the top the page, with the logo in the centre and a list either side. Each list containing three links to pages in the site.
For some reason, the logo doesn't scroll with the page, but .nav, #left and #right do scroll normally.
The page is live here:
afsmma.com
Here's the code:
.nav {
margin: auto;
height: 60px;
width: 100%;
max-width: 900px;
background: #efefef;
font-family: 'Assistant' , sans-serif;
font-weight: 700;
}
#left {
margin: 0;
padding-top: 17px;
padding-left: 20px;
float: left;
list-style: none;
}
#left li {
display: inline-block;
padding-right: 15px;
font-size: 12pt;
}
.afs {
position: absolute;
text-align: center;
width: 100%;
max-width: 900px;
}
.afs img {
margin: 5px auto 0px auto;
height: 50px;
}
#right {
float: right;
margin: 0;
padding-top: 17px;
padding-right: 20px;
list-style: none;
}
#right li {
display: inline-block;
padding-left: 15px;
font-size: 12pt;
}
.hero {
height: 100%;
background: url(/images/ph.jpg) 50% 50% no-repeat;
background-size: cover;
}
<div class="nav">
<ul id="left">
<li>HOME</li>
<li>EVENTS</li>
<li>TICKETS</li>
</ul>
<div class="afs">
<img src="images/LogoCyan.svg">
</div>
<ul id="right">
<li>SHOP</li>
<li>GALLERY</li>
<li>CONTACT</li>
</ul>
</div>
<div class="hero"></div>
A bit of Flex will solve it easily and very cleanly.
Avoid position:absolute and use flex,
DEMO : https://jsfiddle.net/vikas_saini/v6uxh3sc/1/
CSS:
.nav {
margin: auto;
height: 60px;
width: 100%;
max-width: 900px;
background: #efefef;
display:flex;
justify-content: space-between;
font-family: 'Assistant' , sans-serif;
font-weight: 700;
}
#left {
margin: 0;
display:flex;
padding-top: 17px;
padding-left: 20px;
float: left;
list-style: none;
}
#left li {
display: inline-block;
padding-right: 15px;
font-size: 12pt;
}
.afs {
flex-grow: 1;
text-align: center;
width: 100%;
max-width: 900px;
}
.afs img {
margin: 5px auto 0px auto;
height: 50px;
}
#right {
display:flex;
float: right;
margin: 0;
padding-top: 17px;
padding-right: 20px;
list-style: none;
}
#right li {
display: inline-block;
padding-left: 15px;
font-size: 12pt;
}
.hero {
height: 200vh;
background: url(/images/ph.jpg) 50% 50% no-repeat;
background-size: cover;
}
HTML:
<div class="nav">
<ul id="left">
<li>HOME</li>
<li>EVENTS</li>
<li>TICKETS</li>
</ul>
<div class="afs">
<div class="image-container">
<img src="images/LogoCyan.svg">
</div>
</div>
<ul id="right">
<li>SHOP</li>
<li>GALLERY</li>
<li>CONTACT</li>
</ul>
</div>
<div class="hero"></div>
Try position: fixed; or position: absolute; in the .nav class and position: absolute to the .hero class
Try to align your items with flex:
.nav {
margin: auto;
height: 60px;
width: 100%;
max-width: 900px;
background: #efefef;
font-family: 'Assistant' , sans-serif;
font-weight: 700;
display: flex;
justify-content: space-between;
}
#left {
margin: 0;
padding-top: 17px;
padding-left: 20px;
list-style: none;
display: flex;
}
#left li {
display: inline-block;
padding-right: 15px;
font-size: 12pt;
}
.afs {
text-align: center;
width: 100%;
max-width: 900px;
}
.afs img {
margin: 5px auto 0px auto;
height: 50px;
}
#right {
margin: 0;
padding-top: 17px;
padding-right: 20px;
list-style: none;
display: flex;
}
#right li {
display: inline-block;
padding-left: 15px;
font-size: 12pt;
}
.hero {
height: 100%;
background: url(/images/ph.jpg) 50% 50% no-repeat;
background-size: cover;
}
Using flex, you can create some surrounding divs for your ul menus, and specify the widths of each div container to show the menus and logo inline. As for the hero image, moving that after open <body>, you can specify a position of fixed with a z-index of -1 to move it behind the menu. Please see the JSFiddle that shows the new CSS with the actual images from your site.
https://jsfiddle.net/4Lk1ygsp/
.nav {
margin: auto;
height: 60px;
width: 100%;
max-width: 900px;
background: #efefef;
font-family: 'Assistant', sans-serif;
font-weight: 700;
}
#nav-left {
position: relative;
float: left;
width: 300px;
display: inline-flex;
}
#left {
margin: 0;
padding-top: 17px;
padding-left: 20px;
float: left;
list-style: none;
}
#left li {
display: inline-block;
padding-right: 15px;
font-size: 12pt;
}
.afs {
position: absolute;
text-align: center;
width: 100%;
max-width: 900px;
}
.afs img {
margin: 5px auto 0px auto;
height: 50px;
}
#nav-right {
position: relative;
float: right;
width: 300px;
display: inline-flex;
}
#right {
float: right;
margin: 0;
padding-top: 17px;
padding-right: 20px;
list-style: none;
}
#right li {
display: inline-block;
padding-left: 15px;
font-size: 12pt;
}
.hero {
height: 100%;
background: url(http://afsmma.com/images/ph.jpg) 50% 50% no-repeat;
background-size: cover;
position: fixed;
width: 100%;
z-index: -1;
}
#body-container {
width: 900px;
margin: 0px auto;
color: #fff;
}
<!DOCTYPE html>
<html>
<body>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ambition Fight Series</title>
<link href="css/styles.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Assistant:400,700&display=swap" rel="stylesheet">
</head>
<body>
<div class="hero"></div>
<div class="nav">
<div id="nav-left">
<ul id="left">
<li>HOME</li>
<li>EVENTS</li>
<li>TICKETS</li>
</ul>
</div>
<div class="afs">
<img src="http://afsmma.com/images/LogoCyan.svg">
</div>
<div id="nav-right">
<ul id="right">
<li>SHOP</li>
<li>GALLERY</li>
<li>CONTACT</li>
</ul>
</div>
</div>
<div id="body-container">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ullamcorper volutpat nunc vehicula tincidunt. Phasellus vel urna id mi aliquam consequat non eget eros. Fusce rutrum lorem nunc, eu ultricies justo tempor sit amet. Orci varius natoque penatibus
et magnis dis parturient montes, nascetur ridiculus mus. Mauris ante velit, eleifend non nulla et, mollis blandit purus. Curabitur vehicula orci vel ultricies pretium. Donec cursus suscipit arcu, eget dignissim eros scelerisque at. Mauris a blandit
libero. Quisque quis vehicula orci, id dapibus ipsum. Maecenas urna purus, mattis et sollicitudin eget, ullamcorper quis enim. Maecenas sagittis mi vitae justo feugiat pretium. In quis elementum sapien. Integer consequat mi vitae nisl vulputate
feugiat. Curabitur rhoncus, lorem at fermentum sagittis, tellus metus sagittis metus, et ullamcorper massa mi sit amet metus. Mauris nec dictum orci, eu pellentesque mi. Proin maximus et lacus eget vestibulum.
</p>
<p>
In tempor erat nec tristique cursus. Quisque eleifend placerat lacinia. Suspendisse lectus nibh, congue non auctor non, lacinia et erat. Donec pellentesque mi ac sapien luctus, luctus laoreet quam ullamcorper. Donec consequat est neque, id elementum libero
iaculis sit amet. Fusce imperdiet in erat in imperdiet. Cras ullamcorper elit vel nisl efficitur ultricies. Suspendisse potenti. Quisque eu porta erat, a mattis turpis. Quisque aliquam nunc quis felis consectetur, ut interdum tortor sagittis.
Suspendisse posuere ipsum ut ipsum sagittis viverra. Vestibulum feugiat, turpis ut vehicula dignissim, ipsum lectus efficitur magna, facilisis condimentum mi nulla sed mi. Nullam nunc dui, elementum et tellus nec, facilisis convallis libero. Mauris
facilisis, magna ut vestibulum ornare, elit massa pellentesque arcu, sed laoreet nisi erat quis dolor.
</p>
<p>
Donec ut imperdiet nisi. Nullam molestie convallis erat convallis accumsan. Suspendisse in lectus ac orci aliquet consequat. Praesent eleifend, nisl quis vulputate mollis, dui erat dignissim tortor, non mattis felis enim quis magna. Fusce posuere ante
ac orci rutrum, ut varius lectus gravida. Curabitur tristique volutpat sodales. Fusce lobortis volutpat pretium. Integer luctus purus eu neque blandit, id rhoncus diam consectetur. Donec placerat sapien vel augue semper, consequat consequat eros
dictum. Fusce sagittis, nibh at scelerisque finibus, lorem purus aliquam dolor, at finibus quam dui ut dolor.
</p>
<p>
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur vehicula iaculis volutpat. Nullam nibh mi, dapibus a nisl facilisis, consectetur gravida elit. Donec tempus tristique massa semper elementum. Nam mauris
massa, aliquam in dolor ut, porttitor cursus erat. Cras pretium egestas ipsum quis ornare. Nunc sit amet ornare odio.
</p>
<p>
Mauris molestie enim vitae magna venenatis fringilla. Nullam nisi dui, eleifend et erat a, sollicitudin fringilla risus. Integer molestie purus id urna tristique volutpat. Duis interdum pharetra arcu vitae consectetur. Nunc at suscipit quam. Nunc sit
amet gravida risus, malesuada eleifend libero. Aenean quis nibh libero. Morbi ut sapien nec erat sodales tempor at in magna. Etiam pretium velit mi, quis auctor sapien fringilla sit amet. Maecenas ornare, sapien et posuere tempor, nunc justo tempus
odio, ac sodales ipsum lacus quis nisi. Suspendisse viverra turpis at nibh blandit, id sollicitudin purus fermentum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ullamcorper volutpat nunc vehicula tincidunt. Phasellus vel urna id mi aliquam consequat non eget eros. Fusce rutrum lorem nunc, eu ultricies justo tempor sit amet. Orci varius natoque penatibus
et magnis dis parturient montes, nascetur ridiculus mus. Mauris ante velit, eleifend non nulla et, mollis blandit purus. Curabitur vehicula orci vel ultricies pretium. Donec cursus suscipit arcu, eget dignissim eros scelerisque at. Mauris a blandit
libero. Quisque quis vehicula orci, id dapibus ipsum. Maecenas urna purus, mattis et sollicitudin eget, ullamcorper quis enim. Maecenas sagittis mi vitae justo feugiat pretium. In quis elementum sapien. Integer consequat mi vitae nisl vulputate
feugiat. Curabitur rhoncus, lorem at fermentum sagittis, tellus metus sagittis metus, et ullamcorper massa mi sit amet metus. Mauris nec dictum orci, eu pellentesque mi. Proin maximus et lacus eget vestibulum.
</p>
<p>
In tempor erat nec tristique cursus. Quisque eleifend placerat lacinia. Suspendisse lectus nibh, congue non auctor non, lacinia et erat. Donec pellentesque mi ac sapien luctus, luctus laoreet quam ullamcorper. Donec consequat est neque, id elementum libero
iaculis sit amet. Fusce imperdiet in erat in imperdiet. Cras ullamcorper elit vel nisl efficitur ultricies. Suspendisse potenti. Quisque eu porta erat, a mattis turpis. Quisque aliquam nunc quis felis consectetur, ut interdum tortor sagittis.
Suspendisse posuere ipsum ut ipsum sagittis viverra. Vestibulum feugiat, turpis ut vehicula dignissim, ipsum lectus efficitur magna, facilisis condimentum mi nulla sed mi. Nullam nunc dui, elementum et tellus nec, facilisis convallis libero. Mauris
facilisis, magna ut vestibulum ornare, elit massa pellentesque arcu, sed laoreet nisi erat quis dolor.
</p>
<p>
Donec ut imperdiet nisi. Nullam molestie convallis erat convallis accumsan. Suspendisse in lectus ac orci aliquet consequat. Praesent eleifend, nisl quis vulputate mollis, dui erat dignissim tortor, non mattis felis enim quis magna. Fusce posuere ante
ac orci rutrum, ut varius lectus gravida. Curabitur tristique volutpat sodales. Fusce lobortis volutpat pretium. Integer luctus purus eu neque blandit, id rhoncus diam consectetur. Donec placerat sapien vel augue semper, consequat consequat eros
dictum. Fusce sagittis, nibh at scelerisque finibus, lorem purus aliquam dolor, at finibus quam dui ut dolor.
</p>
<p>
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur vehicula iaculis volutpat. Nullam nibh mi, dapibus a nisl facilisis, consectetur gravida elit. Donec tempus tristique massa semper elementum. Nam mauris
massa, aliquam in dolor ut, porttitor cursus erat. Cras pretium egestas ipsum quis ornare. Nunc sit amet ornare odio.
</p>
<p>
Mauris molestie enim vitae magna venenatis fringilla. Nullam nisi dui, eleifend et erat a, sollicitudin fringilla risus. Integer molestie purus id urna tristique volutpat. Duis interdum pharetra arcu vitae consectetur. Nunc at suscipit quam. Nunc sit
amet gravida risus, malesuada eleifend libero. Aenean quis nibh libero. Morbi ut sapien nec erat sodales tempor at in magna. Etiam pretium velit mi, quis auctor sapien fringilla sit amet. Maecenas ornare, sapien et posuere tempor, nunc justo tempus
odio, ac sodales ipsum lacus quis nisi. Suspendisse viverra turpis at nibh blandit, id sollicitudin purus fermentum.
</p>
</div>
</body>
</html>

Underline next to text keep them apart

I am trying to implement the following:
You will see there is text and then a line to its side. I am trying to make the line remain the same distance from the text as the screen decreases in size. This works OK, but when the screen gets smaller the line goes into the 'Test Border' part.
See code below as to how I have implemented this. Perhaps I should be taking a different approach.
Also, a jsfiddle here for your convenience.
h3 {
font-size: 26px;
color: #000 !important;
max-width: 90px;
display: inline-block;
padding-bottom: 15px;
width: 8%;
}
.underline {
display: inline-block;
border-bottom: 1px solid #c6bcb6;
width: 90%;
}
<h3>Test Border</h3>
<div class="underline"></div>
You can display both blocks as table and specify first block fixed width (as it's only text that does not change).
.wrapper {
display: table;
width: 100%;
vertical-align: bottom;
padding-bottom: 15px;
table-layout: fixed;
}
h3 {
font-size: 26px;
color: #000 !important;
max-width: 90px;
display: table-cell;
width: 85px;
}
.underline {
display: table-cell;
border-bottom: 1px solid #c6bcb6;
width: 100%;
position: relative;
top: -12px;
}
<div class="wrapper">
<h3>Test Border</h3>
<div class="underline"></div>
</div>
I'd probably use flex box like this.
.border {
display: flex;
}
.border .string {
font-weight: bold;
font-size: 26px;
flex: 0 1;
}
.border .line {
border-bottom: 1px solid #c6bcb6;
flex: 1;
margin: 0 5px 0 10px;
transform: translate(0, -6px);
}
<div class="border">
<span class="string">Test String</span>
<div class="line"></div>
</div>
This will make the title as wide as the longest unbroken work, and the border will fill up the rest of the space.
Here's what it looks like with paragraphs between each header (an almost real world example)
.border {
display: flex;
}
.border .string {
font-weight: bold;
font-size: 26px;
flex: 0 1;
}
.border .line {
border-bottom: 1px solid #c6bcb6;
flex: 1;
margin: 0 5px 0 5px;
transform: translate(0, -6px);
}
<div class="border">
<span class="string">Lorem ipsum dolor</span>
<div class="line"></div>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In mollis metus at semper laoreet. Vestibulum vitae lectus ut justo consequat dignissim et in eros. Duis aliquam, ipsum et imperdiet venenatis, ipsum augue scelerisque ante, eu lacinia dui metus
sed lectus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Aliquam eu risus a nibh vulputate consectetur. Phasellus id lectus tempor, cursus arcu ut, suscipit augue. Etiam aliquam lobortis semper. Vestibulum dui arcu, faucibus vel suscipit
sed, fermentum sed purus. Vivamus pharetra orci aliquam ligula imperdiet elementum a non tortor. Donec nisl enim, condimentum id nulla quis, vulputate interdum felis. Pellentesque molestie congue urna, eget ultricies est aliquet in. Aenean convallis
magna dolor, vitae facilisis nibh euismod et.
</p>
<div class="border">
<span class="string">Etiam quis molestie</span>
<div class="line"></div>
</div>
<p>
Etiam quis molestie libero. In vitae massa cursus, commodo lectus vel, vehicula felis. Nam venenatis tortor et diam faucibus, vel ullamcorper orci placerat. Mauris at aliquet nunc, quis eleifend turpis. Mauris ultricies at mi ac bibendum. Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Nulla metus enim, volutpat ut magna sed, dignissim tincidunt lorem. Nam nec tempor urna. Nam eget quam elit. Pellentesque condimentum turpis consequat turpis rhoncus vestibulum. Curabitur efficitur dapibus
tortor ac bibendum. Donec risus nibh, dignissim vel sapien vel, fermentum scelerisque velit. Ut posuere finibus erat, nec bibendum nunc faucibus at.
</p>
<div class="border">
<span class="string">Phasellus sed orci</span>
<div class="line"></div>
</div>
<p>
Phasellus sed orci eget urna commodo luctus a sed felis. Aliquam erat volutpat. Quisque sit amet volutpat magna. Etiam vestibulum, velit sit amet efficitur consectetur, tortor velit consectetur velit, et facilisis ex dolor sit amet quam. Fusce tristique
lorem eget dapibus malesuada. Suspendisse iaculis est nec urna sollicitudin, tincidunt vehicula justo pellentesque. Morbi nulla lorem, tempus a interdum vel, fringilla ut elit. Vestibulum sed neque sed lorem viverra luctus. Suspendisse sapien ipsum,
ultrices vitae posuere eget, tristique sit amet augue. Nam suscipit, dolor et lacinia vulputate, erat nunc lacinia nibh, vel posuere nisl nunc eget enim. Vestibulum suscipit lorem risus, id feugiat sem molestie ac. Integer consectetur nunc sed lacinia
commodo. Quisque cursus purus nec dui euismod, nec porttitor nibh fermentum. Nunc tellus mauris, accumsan vitae tincidunt sit amet, ultricies in elit. Donec elementum libero ipsum, sit amet aliquam tortor volutpat eget. Pellentesque pretium dictum ligula.
</p>
<div class="border">
<span class="string">Fusce ultricies ante</span>
<div class="line"></div>
</div>
<p>
Fusce ultricies ante ut orci laoreet, in luctus quam eleifend. Integer nisl purus, pharetra sit amet ligula id, porta porta risus. Etiam nec varius risus, eget euismod risus. Vivamus pharetra purus vitae turpis ultrices ullamcorper. Proin vestibulum,
tortor id blandit pharetra, sapien augue dictum elit, a efficitur urna magna at lorem. Donec sollicitudin, purus sed pharetra iaculis, dolor mauris pretium est, in vestibulum massa odio vitae sapien. Curabitur scelerisque felis dui, non molestie nisl
viverra in. Integer tempor nec risus quis vulputate. Nulla facilisi. Pellentesque ipsum elit, lacinia et consectetur id, gravida ut arcu. Maecenas vestibulum faucibus rutrum. Duis at egestas purus. Proin ac congue nisl, id placerat turpis. Aenean ac
nisl at odio efficitur convallis sit amet quis ipsum. Mauris scelerisque aliquet libero, nec dapibus lectus.
</p>
I think the best solution is change the markup, because with your code the text in h3 tag could be bigger than your max-width (in fact, it is). Something like this:
.textline {
display: table;
}
h3 {
font-size: 26px;
color: #000 !important;
display: table-cell;
width: 9%;
margin-right: 1%;
vertical-align: bottom;
}
.underline {
display: table-cell;
border-bottom: 1px solid #c6bcb6;
width: 90%;
position: relative;
top: -7px;
}
<div class="textline">
<h3>Test border</h3>
<div class="underline"></div>
</div>
When you use percentages you have to take into account the fixed measures of the other elements, width, margins, borders... Not the same 90% of a 1000px screen that one of 500px, the remaining space is less.
You can use calc to solve this issues:
h3 {
font-size: 26px;
color: #000 !important;
width: 95px;
display: inline-block;
padding-bottom: 15px;
}
.underline {
display: inline-block;
border-bottom: 1px solid #c6bcb6;
width: calc(100% - 100px);
}
<h3>Test Border</h3>
<div class="underline"></div>
You could try using a table display, with the text and line each having their own cell:
<div class="div-row">
<div class="div-cell"><h3>Test Border</h3></div>
<div class="div-cell underline"></div>
<div>
CSS:
.div-row {
display: table-row;
width: 100%;
}
.div-cell {
display: table-cell;
}
I haven't tested this, but the div containing the line should automatically shrink to the available width as your resize the browser window (or as you go from desktop to mobile).
If you want, you could also set a fixed width to the div containing the text.
You can try calc() property and it will work...
Check this fiddle here
What you have to do,
h3 {
font-size: 26px;
display: inline-block;
max-width:90px;
margin-right:10px;
}
.underline {
display: inline-block;
border-bottom: 1px solid #c6bcb6;
width: calc(100% - 104px);
}
Try the below CSS:
h3 {
font-size: 26px;
color: #000 !important;
display: inline-block;
padding-bottom: 15px;
}
.underline {
border-bottom: 1px solid #C6BCB6;
width: 90%;
}

I want only content being scrollable

This code works in Chrome as I want but not in IE or Firefox. To be more clear and satisfy SO constrains about the comment-code ratio in a post I'd like that only the content area being scrollable when the viewport goes bellow 300px or the content simply does not fit. Actually IE is my only concern. How could I achieve the same behavior under IE >= v10.
* {
font-family: Helvetica, Sans;
border: 0px;
margin: 0px;
padding: 0px;
}
html,
body {
height: 100%;
overflow: hidden;
}
#table {
display: table;
height: 100%;
width: 100%;
}
.navBar {
width: auto;
height: 72px;
overflow: auto;
border-bottom: 1px solid #bbb;
display: table-row;
}
.results {
background: gray;
width: 100%;
height: 100%;
overflow: auto;
display: table-row;
}
.results > div {
height: 100%;
overflow: auto;
}
#media screen and (max-height: 300px) {
footer {
display: none;
}
}
<body>
<div id="table">
<div class='navBar'>header</div>
<div class='results'>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi faucibus sem quam, quis finibus leo pretium sit amet. Sed imperdiet venenatis enim at sagittis. Praesent porta purus nec aliquet pellentesque. Nunc bibendum urna non risus lacinia, at
venenatis nisl interdum. Duis porta tristique augue vel dictum. Curabitur feugiat tincidunt risus eget semper. Aliquam quis cursus nibh, feugiat commodo arcu. Aliquam non dolor vel ex dapibus interdum vitae nec lorem. Phasellus fermentum neque
ut nibh hendrerit tempus. Pellentesque sit amet ligula dui. Donec laoreet est erat. Etiam aliquet sem sit amet quam tempus aliquam. Vivamus eleifend nunc ipsum, a viverra neque efficitur at. Duis mi nisl, accumsan quis ex et, aliquam lobortis
lectus. Vestibulum luctus diam eu mattis gravida. Quisque nisi felis, posuere vitae purus sit amet, pellentesque fermentum enim. Proin eu dui ex. Nunc nec erat sed augue rhoncus gravida. Suspendisse potenti. Pellentesque mattis lorem felis, a
venenatis odio gravida eget. Nam dictum dui efficitur pellentesque feugiat. Aliquam quis velit sit amet nibh rhoncus lacinia. Ut sed aliquet odio. Phasellus ut eros a nulla viverra convallis aliquet vel risus. Integer eu tellus congue, sodales
leo et, placerat nisi. Quisque semper bibendum tortor. Maecenas sed est sit amet neque convallis lacinia. Praesent vitae dapibus nibh, accumsan lobortis velit. Mauris sed imperdiet lectus. Nunc est turpis, lobortis sit amet hendrerit eu, eleifend
sed dui. Vivamus vulputate semper elit, vitae finibus metus mollis sed.</div>
</div>
<footer>footer</footer>
</div>
</body>
What do you think?
Is it a solution? I got the idea from here
<div class="table">
<!-- Header -->
<div class="row header">Header</div>
<div class="row content">
<!-- Use inner div's with position relative and absolute, to fix cell height, making it overflow correctly. -->
<div class="wrapper">
<div class="inner-content">
<input type="text" />
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi faucibus sem quam, quis finibus leo pretium sit amet. Sed imperdiet venenatis enim at sagittis. Praesent porta purus nec aliquet pellentesque. Nunc bibendum urna non risus lacinia, at venenatis nisl interdum. Duis porta tristique augue vel dictum. Curabitur feugiat tincidunt risus eget semper. Aliquam quis cursus nibh, feugiat commodo arcu. Aliquam non dolor vel ex dapibus interdum vitae nec lorem. Phasellus fermentum neque ut nibh hendrerit tempus. Pellentesque sit amet ligula dui. Donec laoreet est erat. Etiam aliquet sem sit amet quam tempus aliquam. Vivamus eleifend nunc ipsum, a viverra neque efficitur at. Duis mi nisl, accumsan quis ex et, aliquam lobortis lectus. Vestibulum luctus diam eu mattis gravida. Quisque nisi felis, posuere vitae purus sit amet, pellentesque fermentum enim. Proin eu dui ex. Nunc nec erat sed augue rhoncus gravida. Suspendisse potenti. Pellentesque mattis lorem felis, a venenatis odio gravida eget. Nam dictum dui efficitur pellentesque feugiat. Aliquam quis velit sit amet nibh rhoncus lacinia. Ut sed aliquet odio. Phasellus ut eros a nulla viverra convallis aliquet vel risus. Integer eu tellus congue, sodales leo et, placerat nisi. Quisque semper bibendum tortor. Maecenas sed est sit amet neque convallis lacinia. Praesent vitae dapibus nibh, accumsan lobortis velit. Mauris sed imperdiet lectus. Nunc est turpis, lobortis sit amet hendrerit eu, eleifend sed dui. Vivamus vulputate semper elit, vitae finibus metus mollis sed.</div>
<div>Some text.</div>
</div>
</div>
</div>
<!-- footer -->
<div class="row footer">Footer</div>
html, body {
height: 100%;
max-height: 100%;
padding:0px;
margin:0px;
}
.table, .row {
outline: none;
border: none;
outline-style: none;
vertical-align: top;
text-align: left;
}
.table {
border-collapse: collapse;
display: table;
table-layout: fixed;
/* This will ensure the cells within the table will keep there width. */
width: 100%;
height: 100%;
}
.row {
display: table-row;
width: 100%;
}
.header {
background-color: red;
}
.content {
height: 100%;
}
.footer {
background-color: green;
}
.wrapper {
position:relative;
height: 100%
}
.inner-content {
overflow: auto;
position: absolute;
top: 0;
right:0;
bottom: 0;
left: 0;
}
#media screen and (max-height: 300px) {
.footer {
display: none !important;
}
}
I'm not entirely sure what you mean by "only content area being scrollable". This was my interpretation of it:
http://jsfiddle.net/5q1Lgsy6/11/
By using a position: fixed width:100% top bar you can make it so that only the content below it will be scrollable.
I ditched all display: table tags, you don't really need them to organize your content unless that content is supposed to be displayed on an actual table.
Here's the CSS:
* {
font-family: Helvetica, Sans;
border: 0px;
margin: 0px;
padding: 0px;
}
html, body {
height: 100%;
}
#table {
height: 100%;
width: 100%;
}
.navBar {
background-color: white;
top: 0;
width: 100%;
height: 72px;
border-bottom: 1px solid #bbb;
position: fixed;
}
.results {
margin-top: 72px;
background: gray;
width: 100%;
height: 100%;
overflow: auto;
}
.results > div {
height: 100%;
overflow: auto;
}
#media screen and (max-height: 300px) {
footer {
display: none;
}
}
EDIT: if you also want the footer to be permanently fixed add this to your CSS:
footer {
position: fixed;
bottom: 0;
width: 100%;
height: 20px;
background-color: white;
}
there is a way to write css for IE
IE-6 ONLY
* html #div {
height: 300px;
}
IE-7 ONLY
*+html #div {
height: 300px;
}
IE-8 ONLY
#div {
height: 300px\0/;
}
IE-7 & IE-8
#div {
height: 300px\9;
}
NON IE-7 ONLY:
#div {
_height: 300px;
}
Hide from IE 6 and LOWER:
#div {
height/**/: 300px;
}
html > body #div {
height: 300px;
}

Cannot get a div to scroll inside a page, despite using overflow tags

I'm making a website that is using ajax calls to load a content pane. Just mocking this up quick with some data, (on my website the ajax is working fine, so no need for that here) I cannot get the content pane to scroll when it overflows - the entire page scrolls instead.
There are a TON of questions similar to this but every one I've come across they have not used the overflow tag and it fixed their problem. I've tried that but had no success.
I'm not sure how to get the div to recognize that it is being overflowed. The only way so far that I've managed to get it to scroll, is fixing the height, however I feel like that's poor to do, because depending on the screen size I want it to scroll like one would expect.
Here's the html:
<body>
<div id="content-container">
<img src="http://i.imgur.com/69BtzId.png" alt="logo">
<div class="navbar">
<nav>
<ul>
<li class="homeLink"> HOME
</li>
<li id="activePortfolioLink"> PORTFOLIO
</li>
<li class="aboutLink"> ABOUT
</li>
</ul>
</nav>
</div>
<div id="portfolioUnderline"></div>
</div>
<div id="left">
<ul class="verticalNavBar">
<li id="webDesignLink"> <a>WEB DESIGN</a>
</li>
<li id="uiLink"> <a>USER INTERACTION DESIGN</a>
</li>
<li id="graphicDesignLink"> <a>GRAPHIC/ TYPOGRAPHY DESIGN</a>
</li>
</ul>
</div>
<div id="verticalLine"></div>
<div id="rightContent">
<div class="portfolioImages">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ut massa in tortor ullamcorper iaculis. Ut placerat imperdiet metus sed pellentesque. Proin iaculis erat eget fringilla lobortis. Pellentesque sit amet urna condimentum, tristique erat et, egestas ante. Duis eu pulvinar leo, fringilla posuere ligula. Nunc commodo tellus at lorem interdum feugiat. Cras varius consequat diam vitae scelerisque. Mauris nec ligula in mi accumsan scelerisque sed vel augue. Aliquam elementum, dolor id ornare feugiat, ante justo sollicitudin erat, ut gravida velit nibh vel velit. Fusce ultrices consectetur eros, ac tincidunt libero auctor ut. Quisque dapibus congue arcu sed imperdiet. Pellentesque lorem nisi, dictum sit amet libero in, cursus eleifend ante. Nunc vel euismod erat. Duis massa tellus, tincidunt in fermentum ut, sagittis vulputate lectus. Nunc ut iaculis nibh. In congue laoreet arcu commodo imperdiet. Nullam rutrum augue nec mauris rhoncus facilisis. Donec bibendum luctus magna. Vivamus tempor egestas turpis. Curabitur non porta lorem, nec elementum ante. Cras faucibus consequat augue, laoreet pretium lorem tincidunt sed. Vestibulum magna dolor, pulvinar vitae facilisis eget, posuere sit amet est. Suspendisse vel elit a neque laoreet faucibus eget et quam. Integer feugiat, tellus sit amet tempus dignissim, neque justo congue enim, quis commodo neque neque quis orci. Suspendisse scelerisque erat lobortis felis fermentum, in molestie nulla pharetra. Suspendisse lacinia ac orci et tincidunt. Duis lobortis at leo a viverra. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam libero turpis, consequat non convallis at, eleifend non dolor.</br>
</br>
</br>
</br>
</br>Maecenas tincidunt lorem vitae fringilla consectetur. Interdum et malesuada fames ac ante ipsum primis in faucibus. Maecenas sit amet magna tincidunt, pellentesque arcu posuere, euismod lectus. Sed nec pellentesque diam, id varius quam. Praesent mattis sapien odio, in mattis dui tempus sit amet. Morbi pulvinar odio nec augue tempus varius. Sed porttitor consequat magna, sit amet lobortis mauris congue eleifend. Donec pretium elit vitae egestas rutrum. Sed sapien libero, vulputate eu lacinia sit amet, aliquam et elit. Aenean nisi mi, vulputate id nulla ut, vestibulum porta enim. Nunc quis tellus eleifend, adipiscing lorem in, congue justo. Vivamus ornare risus quis faucibus pretium. Vestibulum eu velit placerat, lacinia justo rutrum, sagittis nisi. Donec quis tincidunt justo, eu posuere mauris. Morbi eleifend, dui eget aliquet adipiscing, tellus risus hendrerit dolor, non aliquet magna sapien malesuada ante. Fusce lobortis commodo sem id tempus. Nulla eget vehicula mi, id volutpat erat. Proin sed enim egestas, rhoncus ipsum a, consectetur mi. Quisque est arcu, tempus a ligula eu, aliquam elementum quam. Sed tristique sit amet sapien eget ornare. In vitae adipiscing neque. Ut aliquet felis vitae porttitor vehicula. Morbi aliquam rhoncus lacinia. Vestibulum at viverra nisl. Donec rhoncus, dolor eu luctus egestas, magna leo consequat justo, ac venenatis odio ligula ac tortor. Nullam faucibus ante enim, vitae cursus mauris interdum ut. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc turpis massa, viverra vitae rutrum non, elementum sit amet orci.</p>
</div>
</div>
</body>
Here's the CSS:
* {
font-family:'Lato', sans-serif;
font-weight: lighter;
padding: 0;
margin: 0;
color:white;
}
body {
background: #111111;
height: 100%;
}
#content-container {
background-color: #111111;
height: 113px;
width: 100%;
}
#content-container img {
padding: 15px;
padding-top: 15px;
/*float: left; */
}
.navbar {
float: right;
background-color: #111111;
font-size: 25px;
padding-top: 45px;
}
nav ul li {
display: inline;
}
nav ul li a {
text-decoration: none;
color: white;
padding: 15px;
float:right;
}
nav ul li.homeLink a {
padding-left: 41px;
padding-right: 43px;
}
nav ul li.portfolioLink a {
padding-left: 9px;
padding-right: 9px;
padding-bottom: 1px;
}
nav ul li.aboutLink a {
padding-left: 37px;
padding-right: 37px;
}
#activePortfolioLink a {
padding-left: 9px;
padding-right: 9px;
background: #0033cc;
font-weight: normal;
}
#portfolioUnderline {
background-color: #0033cc;
width: 100%;
height: 10px;
margin-top: -12px;
}
#left {
float: left;
width: 300px;
overflow: hidden;
}
#rightContent {
margin-left: 300px padding-left:300px;
height:100%;
overflow:scroll;
}
.verticalNavBar {
float: right;
text-align: right;
margin-top: 20px;
color: white;
font-size: 15px;
}
.verticalNavBar li {
list-style: none;
color: white;
padding-top:10px;
padding-bottom: 10px;
}
.verticalNavBar li a {
text-decoration: none;
color: white;
padding: 10px;
}
#verticalLine {
background-color: #0033cc;
float:left;
width: 10px;
height: 905px;
}
#webDesignLink a {
background: #0033cc;
font-weight: normal;
}
.portfolioImages {
margin: 0 auto;
padding-top: 20px;
padding: 10;
margin-right: 10%;
margin-left: 10%;
margin-bottom: 20px;
overflow: auto;
}
img.individualImage {
margin-left: 450px;
}
.portfolioImages p {
font-size: 15px;
font-weight: lighter;
text-align: center;
}
Here's a jsfiddle of the code: http://jsfiddle.net/GGSSj/
Thanks for your time!
You can fix the height in relation to the screen size, but you have to fix the height /somehow/ to get it to scroll independently.
Here is a fiddle with absolute positioning of each segment: http://jsfiddle.net/GGSSj/3/
#content-container {
position:absolute; top:0; left:0; width:100%; height:113px;
}
#left {
position:absolute; top:123px; bottom:0; left:0; width:300px;
}
#rightContent {
position:absolute; top:123px; bottom:0; left:310px; right:0;
overflow-y:scroll;
}
You can fix the height in relation to the screen size, but you will have to fix the height the scrollable container (somehow with javascript for full screen height) to get it to scroll independently.
Give it a try : fiddle updated here
#rightContent {
height: 555px; /* fit height to your needs */
overflow: auto;
}
You need to set your top area and your left area to position:fixed;
http://jsfiddle.net/GGSSj/
#left {
position:fixed;
top: 113px;
left: 0;
width: 300px;
overflow: hidden;
}
#rightContent {
margin-left:300px;
padding-top:113px;
height:100%;
overflow: auto;
}
#content-container {
position: fixed;
background-color: #111111;
height: 113px;
width: 100%;
}