So I have this markup:
<header>
<h1> Movy </h1>
<span class="tools" style='display: none'>
<button id='edit'>
<i class="fa fa-pencil"></i>
</button>
<button id='check'>
<i class="fa fa-check"></i>
</button>
<button id='trash'>
<i class="fa fa-trash-o"></i>
</button>
</span>
</header>
<nav id='nav'>
<ul class='navbar-nav'>
<li id='came-out'>Came Out</li>
<li class='active' id='coming-soon'>Coming Soon</li>
<li id='watched'>Watched</li>
</ul>
</nav>
...
And I want the header to be fixed, and the navbar to scroll.
So I added this to the CSS:
header {
position: fixed;
width: 100%;
z-index: 1000;
}
nav {
margin-top: 1em;
}
But the result is not what I wanted. I tried adding clear: both to every element but nothing has changed.
EDIT: This is how it should look like, but the header should be fixed.
You'll need to set the height of your header to a fixed height (in em or in px). Then add a padding top to your body with the same number.
body {
background: #e5e5e5;;
font-family: 'Roboto Condensed', 'Calibri', 'Arial', sans-serif;
margin: 0; padding: 0;
color: #444;
height: 2000px;
padding-top: 50px;
}
header {
background: #4285f4;
color: white;
padding: 12px;
padding-left: 15px;
position: fixed;
width: 100%;
z-index: 1000;
height: 26px;
margin: 0;
top: 0;
}
And take away the margin of the nav.
Check this Fiddle.
Add a wrapper div for your nav, and the rest of the page, and set a margin-top to clear the header div.
<header>
<h1> Movy </h1>
<span class="tools" style='display: none'>
<button id='edit'>
<i class="fa fa-pencil"></i>
</button>
<button id='check'>
<i class="fa fa-check"></i>
</button>
<button id='trash'>
<i class="fa fa-trash-o"></i>
</button>
</span>
</header>
<div id='wrapper'>
<nav id='nav'>
<ul class='navbar-nav'>
<li id='came-out'>Came Out</li>
<li class='active' id='coming-soon'>Coming Soon</li>
<li id='watched'>Watched</li>
</ul>
</nav>
</div>
CSS:
header {
position: fixed;
width: 100%;
z-index: 1000;
top:0;
}
.wrapper {
margin-top: 3em;
display:block;
}
Related
When i click on the dropdown menu or hover over the dropdown list's elements.. the browser window shakes. The shaking effect disappears when i remove the .row and .column classes from the markup.. I am using bootstrap for most of the purpose (including dropdown menu and grid) in this project
here's the markup.
#import url('https://fonts.googleapis.com/css2?family=Lato:wght#300;400;700&display=swap');
#nav-left {
background-color: #44403b;
height: 92vh;
overflow: hidden;
#navigation {
padding: 10px;
width: 100%;
color: #acb2d4;
font-size: 18px;
letter-spacing: 0.5px;
background-color: #322e2b;
}
ul.menu {
padding: 0;
margin : 0;
list-style: none;
li {
&:hover {
background-color: #49423f;
}
a {
text-decoration: none;
display: block;
padding: 15px;
cursor: pointer;
font-size: 18px;
color: #acb2d4;
border-bottom: 1px solid #515151;
&.parent::after {
content: "\f107";
font: normal normal normal 14px/2 FontAwesome;
float: right;
margin-right: 8px;
}
//collapsed class is overriding the content of parent class, but when we click the collapsed class changes to
// collapse and then the content of parent is shown
&.collapsed::after {
content: "\f105";
}
}
}
}
& li ul#sub-menu1 {
margin:0;
padding: 0;
list-style: none;
& li {
line-height: 10px;
&:hover {
background-color: #48423f;
}
a {
transition: all 0.5s;
}
}
}
& li ul li a:hover {
transform:translateX(10px);
background-color: #322e2b;
width: 100%;
overflow: hidden;
}
}
<div class="row">
<div class="col-2">
<nav id="nav-left">
<div id="navigation"><i class="fa fa-bars"></i> Navigation</div>
<ul class="menu">
<li class="active">
<i class="fa fa-dashboard fw"></i> Dashboard
</li>
<li>
<a data-toggle="collapse"
href="#sub-menu1"
role="button"
aria-expanded="false"
aria-controls="sub-menu1"
class="parent collapsed">
<i class="fa fa-user fw"></i>
Users
</a>
<ul class="collapse" id="sub-menu1">
<li>
<i class="fa fa-users text-primary"></i> All Users
</li>
<li>
<i class="fa fa-plus text-secondary"></i> New Users
</li>
<li>
<i class="fa fa-dot-circle-o text-success"></i> Active Users
</li>
<li>
<i class="fa fa-dot-circle-o text-danger"></i> Inactive Users
</li>
<li>
<i class="fa fa-ban"></i> Blocked Users
</li>
</ul>
</li>
<li>
<i class="fa fa-calendar"></i> Events
</li>
</ul>
</nav>
</div>
<div class="col-10">
<div class="row">
<div class="col-4">
</div>
<div class="col-4"></div>
<div class="col-4"></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-4"></div>
<div class="col-4"></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-4"></div>
<div class="col-4"></div>
</div>
</div>
</div>
Could it be so simple that it is the browsers vertical scrollbar that appears? Is the drop down very high?
If so you can make the vertical browser scrollbar visible all the time by adding a css Rule
body {
overflow: scroll;
}
Adds both the vertical and horizontal scrollbar all the time
Use overflow-y only for vertical
I have a problem linking html(<li class="active"></li>) to icons and I do not know how to make icons different color after I click on them (color of an icon is black, when I click on an icon it does not stay white). I tried another way to get html in but then the animation did not work. I looked at millions of pages and I could not find an answer. On top of that, I am new to coding.
body
{
margin: 0;
padding: 0;
font-family: sans-serif;
background: #273847;
}
ul
{
justify-content: center;
text-align: center;
min-width: 100%;
position: fixed;
top: 100%;
left: 50%;
transform: translate(-50%,-50%);
margin: 0;
padding: 15px 0;
background: #2b3e4f;
display: flex;
border-radius: 10px;
}
ul li
{
list-style: none;
text-align: center;
display: block;
}
ul li:last-child
{
border-right: none;
}
ul li a
{
text-decoration: none;
padding: 0 27px;
display: block;
}
ul li a .icon
{
width: 40px;
height: 90px;
text-align: center;
overflow: hidden;
margin: 0 auto 10px;
}
ul li a .icon .fa
{
width: 100%;
height: 100%;
line-height: 40px;
font-size: 40px;
transition: 0.5s;
color: #0a0e12;
}
ul li a .icon .fa:last-child
{
color: #eeeeee;
}
ul li a:hover .icon .fa
{
transform: translateY(-100%);
}
/*
ul li a .name
{
position: relative;
height: 20px;
width: 100%;
display: block;
overflow: hidden;
}
ul li a .name span
{
display: block;
position: relative;
color: #000;
font-size: 18px;
line-height: 20px;
transition: 0.5s;
}
ul li a .name span:before
{
content: attr(data-text);
position: absolute;
top: -100%;
left 0;
width: 100%;
height: 100%;
color: #eeeeee;
}
ul li a:hover .name span
{
transform: translateY(20px);
}
*/
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<ul>
<div>
<ul>
<li class="active"></li>
</ul>
</div>
<li>
<a>
<div class="icon">
<i class="fa fa-home" aria-hidden="true"></i>
<i class="fa fa-home" aria-hidden="true"></i>
</div>
<!-- <div class="icon"><span data-text="Home">Home</span></div> -->
</a>
</li>
<div>
<ul>
<li></li>
</ul>
</div>
<li>
<a>
<div class="icon">
<i class="fa fa-tag" aria-hidden="true"></i>
<i class="fa fa-tag" aria-hidden="true"></i>
</div>
<!-- <div class="icon"><span data-text="About">About</span></div> -->
</a>
</li>
<div>
<ul>
<li></li>
</ul>
</div>
<li>
<a>
<div class="icon">
<i class="fa fa-envelope" aria-hidden="true"></i>
<i class="fa fa-envelope" aria-hidden="true"></i>
</div>
<!-- <div class="icon"><span data-text="Contact">Contact</span></div> -->
</a>
</li>
<div>
<ul>
<li></li>
</ul>
</div>
<li>
<a>
<div class="icon">
<i class="fa fa-cog" aria-hidden="true"></i>
<i class="fa fa-cog" aria-hidden="true"></i>
</div>
<!-- <div class="icon"><span data-text="Settings">Settings</span></div> -->
</a>
</li>
</ul>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
I doubt you can solve this issue with a css-only solution - I might be wrong though.
Nevertheless you can do it with some Javascript trickery which goes a little like this:
layer an additional icon on top of your current icons, give it the desired color e.g. red and make it invisible by setting it's css opacity property to 0
attach a click event listener to the freshly created icons
inside the callback handler reset the opacity of all the red active icons to 0, reset the opacity of all the icons below (those that are used for the CSS animation effect) to 1, make the clicked icon visible and finally the two icons in the background invisible.
Here's an example (just click on 'Run code snippet'):
var buttons = document.getElementsByClassName("active");
buttons[0].addEventListener("click", clicked);
function clicked(e) {
var iconsToShow = document.querySelectorAll(`[class*="icon"]`);
iconsToShow.forEach(
function(currentValue, currentIndex, listObj) {
currentValue.style.opacity = 1;
});
var iconsToHide = document.querySelectorAll(`[class*="active"]`);
iconsToHide.forEach(
function(currentValue, currentIndex, listObj) {
currentValue.firstElementChild.style.opacity = 0;
});
var iconToHide = e.target.parentElement.parentElement.querySelectorAll(`[class*="icon"]`)[0];
iconToHide.style.opacity = 0;
e.target.style.opacity = 1;
}
for (var a = 0; a < buttons.length; a++) {
buttons[a].addEventListener("click", clicked);
}
body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: #273847;
}
ul {
justify-content: center;
text-align: center;
min-width: 100%;
position: fixed;
top: 100%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
padding: 15px 0;
background: #2b3e4f;
display: flex;
border-radius: 10px;
}
ul li {
list-style: none;
text-align: center;
display: block;
}
ul li:last-child {
border-right: none;
}
ul li a {
text-decoration: none;
padding: 0 27px;
display: block;
}
ul li a .icon {
width: 40px;
height: 90px;
text-align: center;
overflow: hidden;
margin: 0 auto 10px;
}
ul li a .icon .fa {
width: 100%;
height: 100%;
line-height: 40px;
font-size: 40px;
transition: 0.5s;
color: #0a0e12;
}
ul li a .active .fa {
font-size: 40px;
transform: translateY(-250%);
color: #ff0e12;
opacity: 0;
}
ul li a .icon .fa:last-child {
color: #eeeeee;
}
ul li a:hover .icon .fa {
transform: translateY(-100%);
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<body>
<ul>
<div>
<ul>
<li>
</li>
</ul>
</div>
<li>
<a class="button">
<div class="icon">
<i class="fa fa-home" aria-hidden="true"></i>
<i class="fa fa-home" aria-hidden="true"></i>
</div>
<div class="active">
<i class="fa fa-home" aria-hidden="true"></i>
</div>
</a>
</li>
<div>
<ul>
<li>
</li>
</ul>
</div>
<li>
<a>
<div class="icon">
<i class="fa fa-tag" aria-hidden="true"></i>
<i class="fa fa-tag" aria-hidden="true"></i>
</div>
<div class="active">
<i class="fa fa-tag" aria-hidden="true"></i>
</div>
</a>
</li>
<div>
<ul>
<li>
</li>
</ul>
</div>
<li>
<a>
<div class="icon">
<i class="fa fa-envelope" aria-hidden="true"></i>
<i class="fa fa-envelope" aria-hidden="true"></i>
</div>
<div class="active">
<i class="fa fa-envelope" aria-hidden="true"></i>
</div>
</a>
</li>
<div>
<ul>
<li>
</li>
</ul>
</div>
<li>
<a>
<div class="icon">
<i class="fa fa-cog" aria-hidden="true"></i>
<i class="fa fa-cog" aria-hidden="true"></i>
</div>
<div class="active">
<i class="fa fa-cog" aria-hidden="true"></i>
</div>
</a>
</li>
</ul>
</body>
I am designing an electron application with a tabpane. However when the user makes the window smaller or adds more tabs the scrollbar that is supposed to let users see all the tabs does not work correctly. The scrollbar allows for a little movement but most of the tabs overflow regardless. I have uploaded a stripped down code snippet version of the app here so you can see my problem in more detail.
body {
margin: 0;
width: 100vw;
height: 100vh;
overflow-x: hidden;
display: flex;
flex-direction: column;
}
.window {
position: relative;
display: flex;
flex-grow: 1;
}
.window__content {
display: flex;
flex-direction: column;
flex-grow: 1;
}
ul {
padding: 0;
margin: 0;
list-style: none;
}
.action-bar {
display: flex;
flex-shrink: 0;
flex-direction: column;
overflow: hidden;
width: 44px;
transition: width 0.2s ease;
}
.action-bar .action-bar__item {
white-space: nowrap;
padding: 6px 12px;
}
.action-bar i {
font-size: 20px;
margin-right: 22px;
}
.action-bar__spacer {
flex-grow: 1;
}
.console {
position: relative;
height: 44px;
transition: all 0.5s ease;
min-height: 44px;
max-height: 50%;
overflow: hidden;
font-size: 13px;
}
.tabpane {
display: flex;
flex-grow: 1;
flex-direction: column;
height: 100%;
position: relative;
}
.tabpane .tabpane__tabs {
position: relative;
white-space: nowrap;
flex-shrink: 0;
overflow-x: auto;
}
.tabpane .tabpane__tabs li {
position: relative;
display: inline-block;
padding: 8px;
font-size: 13px;
min-width: 80px;
max-width: 160px;
border: solid #1E1E1E;
border-width: 0 1px;
margin-right: -5px;
color: #8D8D8D;
background: #333333;
}
.tabpane .tabpane__tabs li:hover {
cursor: pointer;
}
.tabpane .tabpane__tabs li.tab--active {
border-top-width: 1px;
padding-top: 7px;
background: #1E1E1E;
color: white;
z-index: 2;
}
.tabpane .tabpane__tabs li i {
float: right;
visibility: hidden;
}
.tabpane .tabpane__tabs li:hover i, .tabpane .tabpane__tabs li.tab--active i {
visibility: visible;
}
#draggableTab {
color: #8D8D8D;
background-color: rgba(51,51,51,0.9);
outline: 1px solid rgba(64,64,64,0.9);
padding: 7px 8px;
font-size: 13px;
min-width: 80px;
cursor: pointer;
position: fixed;
z-index: 10030;
pointer-events: none;
white-space: nowrap;
}
#draggableTab i {
color: white;
float: right;
opacity: 0.3;
position: relative;
z-index: 9999;
}
.tabpane__panes {
position: relative;
display: flex;
flex-grow: 1;
overflow-y: scroll;
}
.tabpane__panes li {
display: none;
}
.tabpane__panes li.pane--active {
display: initial;
flex: 1;
padding: 0 44px;
background: #1E1E1E;
}
/* Colors */
.theme--dark {
color: white;
}
.shade--light {
background: #333333;
}
.shade--neutral {
background: #252526;
}
.shade--dark {
background: #1E1E1E;
}
.shade--darker {
background: #141516;
}
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta charset="UTF-8">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
</head>
<body class="theme--dark shade--dark">
<div class="window">
<ul class="action-bar shade--neutral">
<li class="action-bar__item" title="Expand"><i class="fa fa-bars" aria-hidden="true"></i></li>
<li class="action-bar__item" title="Home" data-template="home"><i class="fa fa-home" aria-hidden="true"></i>Home</li>
<li class="action-bar__item" title="Search" data-template="search"><i class="fa fa-search" aria-hidden="true"></i>Search</li>
<li class="action-bar__item" title="Download" data-template="download"><i class="fa fa-download" aria-hidden="true"></i>Download</li>
<li class="action-bar__item" title="Statistics" data-template="statistics"><i class="fa fa-pie-chart" aria-hidden="true"></i>Statistics</li>
<li class="action-bar__item" title="Help" data-template="help"><i class="fa fa-question-circle" aria-hidden="true"></i>Help</li>
<li class="action-bar__divider shade--light"></li>
<li class="action-bar__item" title="Lights On"><i class="fa fa-sun-o" aria-hidden="true"></i>Lights On</li>
<li class="action-bar__item" title="Console"><i class="fa fa-code" aria-hidden="true"></i>Console</li>
<li class="action-bar__spacer"></li>
<li class="action-bar__item" title="Lock"><i class="fa fa-lock" aria-hidden="true"></i>Lock</li>
<li class="action-bar__item" title="Settings" data-template="settings"><i class="fa fa-cog" aria-hidden="true"></i>Settings</li>
</ul>
<div class="window__content">
<div class="tabpane">
<ul class="tabpane__tabs shade--neutral">
<li template="home" source="undefined" class="tab--active left">
Home
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_1" source="undefined" class="">
page 1
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_2" source="undefined" class="">
page 2
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_3" source="undefined" class="">
page 3
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_4" source="undefined" class="">
page 4
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_5" source="undefined" class="">
page 5
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_6" source="undefined" class="">
page 6
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_7" source="undefined" class="">
page 7
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_8" source="undefined" class="">
page 8
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
</ul>
<ul class="tabpane__panes">
<li class="pane--active">
<h1>Hello</h1>
<div style="max-width: 400px;">
<p>Try resizing your browser window until some tabs are hidden and a scrollbar appears.</p>
<p>I have removed the JavaScript for this example don't expect buttons to work. The scrollbar however needs to work no matter the height of the console window below the tabs or the width of the action bar to the left.</p>
</div>
</li>
<li>page for page 2</li>
<li>page for page 3</li>
<li>page for page 4</li>
<li>page for page 5</li>
<li>page for page 6</li>
<li>page for page 7</li>
<li>page for page 8</li>
</ul>
</div>
<div class="console console--is-closed shade--darker">
<div class="console__close"><span class="lnr lnr-cross"></span></div>
<div class="console__area">
<div class="console__resize-bar"></div>
<p><span class="console__point">Console> </span><input type="text" class="console__input"></p>
</div>
</div>
</div>
</div>
</body>
</html>
I think this would work for you.
just remove the flex-grow: 1; from .window__content and add width: calc(100% - 44px);
width: calc(100% - 44px); == width: calc(100% - .action-bar[width]);
body {
margin: 0;
width: 100vw;
height: 100vh;
overflow-x: hidden;
display: flex;
flex-direction: column;
}
.window {
position: relative;
display: flex;
flex-grow: 1;
}
.window__content {
display: flex;
flex-direction: column;
width: calc(100% - 44px);
}
ul {
padding: 0;
margin: 0;
list-style: none;
}
.action-bar {
display: flex;
flex-shrink: 0;
flex-direction: column;
overflow: hidden;
width: 44px;
transition: width 0.2s ease;
}
.action-bar .action-bar__item {
white-space: nowrap;
padding: 6px 12px;
}
.action-bar i {
font-size: 20px;
margin-right: 22px;
}
.action-bar__spacer {
flex-grow: 1;
}
.console {
position: relative;
height: 44px;
transition: all 0.5s ease;
min-height: 44px;
max-height: 50%;
overflow: hidden;
font-size: 13px;
}
.tabpane {
display: flex;
flex-grow: 1;
flex-direction: column;
height: 100%;
position: relative;
}
.tabpane .tabpane__tabs {
position: relative;
white-space: nowrap;
flex-shrink: 0;
overflow-x: auto;
}
.tabpane .tabpane__tabs li {
position: relative;
display: inline-block;
padding: 8px;
font-size: 13px;
min-width: 80px;
max-width: 160px;
border: solid #1E1E1E;
border-width: 0 1px;
margin-right: -5px;
color: #8D8D8D;
background: #333333;
}
.tabpane .tabpane__tabs li:hover {
cursor: pointer;
}
.tabpane .tabpane__tabs li.tab--active {
border-top-width: 1px;
padding-top: 7px;
background: #1E1E1E;
color: white;
z-index: 2;
}
.tabpane .tabpane__tabs li i {
float: right;
visibility: hidden;
}
.tabpane .tabpane__tabs li:hover i, .tabpane .tabpane__tabs li.tab--active i {
visibility: visible;
}
#draggableTab {
color: #8D8D8D;
background-color: rgba(51,51,51,0.9);
outline: 1px solid rgba(64,64,64,0.9);
padding: 7px 8px;
font-size: 13px;
min-width: 80px;
cursor: pointer;
position: fixed;
z-index: 10030;
pointer-events: none;
white-space: nowrap;
}
#draggableTab i {
color: white;
float: right;
opacity: 0.3;
position: relative;
z-index: 9999;
}
.tabpane__panes {
position: relative;
display: flex;
flex-grow: 1;
overflow-y: scroll;
}
.tabpane__panes li {
display: none;
}
.tabpane__panes li.pane--active {
display: initial;
flex: 1;
padding: 0 44px;
background: #1E1E1E;
}
/* Colors */
.theme--dark {
color: white;
}
.shade--light {
background: #333333;
}
.shade--neutral {
background: #252526;
}
.shade--dark {
background: #1E1E1E;
}
.shade--darker {
background: #141516;
}
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta charset="UTF-8">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
</head>
<body class="theme--dark shade--dark">
<div class="window">
<ul class="action-bar shade--neutral">
<li class="action-bar__item" title="Expand"><i class="fa fa-bars" aria-hidden="true"></i></li>
<li class="action-bar__item" title="Home" data-template="home"><i class="fa fa-home" aria-hidden="true"></i>Home</li>
<li class="action-bar__item" title="Search" data-template="search"><i class="fa fa-search" aria-hidden="true"></i>Search</li>
<li class="action-bar__item" title="Download" data-template="download"><i class="fa fa-download" aria-hidden="true"></i>Download</li>
<li class="action-bar__item" title="Statistics" data-template="statistics"><i class="fa fa-pie-chart" aria-hidden="true"></i>Statistics</li>
<li class="action-bar__item" title="Help" data-template="help"><i class="fa fa-question-circle" aria-hidden="true"></i>Help</li>
<li class="action-bar__divider shade--light"></li>
<li class="action-bar__item" title="Lights On"><i class="fa fa-sun-o" aria-hidden="true"></i>Lights On</li>
<li class="action-bar__item" title="Console"><i class="fa fa-code" aria-hidden="true"></i>Console</li>
<li class="action-bar__spacer"></li>
<li class="action-bar__item" title="Lock"><i class="fa fa-lock" aria-hidden="true"></i>Lock</li>
<li class="action-bar__item" title="Settings" data-template="settings"><i class="fa fa-cog" aria-hidden="true"></i>Settings</li>
</ul>
<div class="window__content">
<div class="tabpane">
<ul class="tabpane__tabs shade--neutral">
<li template="home" source="undefined" class="tab--active left">
Home
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_1" source="undefined" class="">
page 1
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_2" source="undefined" class="">
page 2
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_3" source="undefined" class="">
page 3
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_4" source="undefined" class="">
page 4
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_5" source="undefined" class="">
page 5
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_6" source="undefined" class="">
page 6
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_7" source="undefined" class="">
page 7
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
<li template="page_8" source="undefined" class="">
page 8
<i class="fa fa-times" aria-hidden="true" title="Close (Ctrl+W)"></i>
</li>
</ul>
<ul class="tabpane__panes">
<li class="pane--active">
<h1>Hello</h1>
<div style="max-width: 400px;">
<p>Try resizing your browser window until some tabs are hidden and a scrollbar appears.</p>
<p>I have removed the JavaScript for this example don't expect buttons to work. The scrollbar however needs to work no matter the height of the console window below the tabs or the width of the action bar to the left.</p>
</div>
</li>
<li>page for page 2</li>
<li>page for page 3</li>
<li>page for page 4</li>
<li>page for page 5</li>
<li>page for page 6</li>
<li>page for page 7</li>
<li>page for page 8</li>
</ul>
</div>
<div class="console console--is-closed shade--darker">
<div class="console__close"><span class="lnr lnr-cross"></span></div>
<div class="console__area">
<div class="console__resize-bar"></div>
<p><span class="console__point">Console> </span><input type="text" class="console__input"></p>
</div>
</div>
</div>
</div>
</body>
</html>
Hope this was helpfull for you.
The problem is the width of your tabpane. It should not be 100% (default), since there is the action bar on the left side
.tabpane {
display: flex;
flex-grow: 1;
flex-direction: column;
height: 100%;
position: relative;
}
add
width:90%;
or whatever 100% - 44px would be
I think;
.window__content {
width: 90%; // add
}
This question already has an answer here:
How can I draw a left pointing triangle using CSS?
(1 answer)
Closed 6 years ago.
I'm actually trying to implement a design done for me into HTML5 and CSS3 with Twitter Bootstrap.
I've got a sidebar on the left of the screen with a list inside, nothing complex.
<html>
<section class="sidebar">
<ul class="sidebar-menu">
<li class="active">
<a href="/home">
<i class="fa fa-users active-fa"></i>
<span class="menu-title">MY USERS</span>
</a>
</li>
</ul>
</section>
</html>
I would like to arrive to this result :
Any idea on the CSS code to manage to have that triangle on the right side centered in the middle bottom right ?
You can achieve that triangle with a pseudo element ::after, some positioning and transforming:
li {
position: relative;
display: block;
background: #04a4a9;
padding: 1em;
overflow: hidden;
}
li a {
color: white;
text-decoration: none;
}
li::after {
content: '';
position: absolute;
width: 15px;
height: 15px;
background: white;
right: -8px;
top: 50%;
transform: translate(0, -50%) rotate(45deg);
}
<section class="sidebar">
<ul class="sidebar-menu">
<li class="active">
<a href="/home">
<i class="fa fa-users active-fa"></i>
<span class="menu-title">MY USERS</span>
</a>
</li>
</ul>
</section>
You can achieve this using CSS pseudo elements:
To avoid wasting time with the triangle itself, just use a generator.
.btn {
display: flex;
align-items: center;
align-content: center;
justify-content: center;
background: #53BED1;
color: #fff;
width: 400px;
height: 150px;
position: relative;
}
.btn::before {
right: 0;
top: 40%;
position: absolute;
content: '';
width: 0;
height: 0;
border-style: solid;
border-width: 15px 20px 15px 0;
border-color: transparent #ffffff transparent transparent;
}
<div class="btn">My users</div>
You may indeed use a pseudo.
You can also draw background-color of li from that pseudo via a box-shadow, so the triangle is translucide.
You can use color on li to easily change bg-colors since you reset color on <a>, box-shadow color inherits color value(currentcolor) if none set in the rule (so does border-color)..
li {
position: relative;
display: inline-block;
padding: 1em;
overflow: hidden;
color:tomato;
text-shadow:1px 1px black;
}
li:nth-child(even) {
color:turquoise
}
li.active {
color: #04a4a9;
}
li a {
color: white;
text-decoration: none;
position: relative;
z-index: 1;
}
li::after {
content: '';
position: absolute;
width:0px;
height: 15px;
margin: -8px;
right: 0;
top: 50%;
transform: rotate(45deg);
box-shadow: 0 0 0 400px;
}
li.active::after {
width:15px;;
}
/*demo to check if you can see through */
body {
background:linear-gradient(45deg,gray,yellow,pink,blue,gray,yellow,pink,blue,gray,yellow,pink,blue,gray,yellow,pink,blue);
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" />
<section class="sidebar">
<ul class="sidebar-menu">
<li>
<a href="/home">
<i class="fa fa-users active-fa"></i>
<span class="menu-title">MY USERS</span>
</a>
</li>
<li class="active">
<a href="/home">
<i class="fa fa-users active-fa"></i>
<span class="menu-title">MY USERS</span>
</a>
</li>
<li>
<a href="/home">
<i class="fa fa-users active-fa"></i>
<span class="menu-title">MY USERS</span>
</a>
</li>
<li>
<a href="/home">
<i class="fa fa-users active-fa"></i>
<span class="menu-title">MY USERS</span>
</a>
</li>
<li>
<a href="/home">
<i class="fa fa-users active-fa"></i>
<span class="menu-title">MY USERS</span>
</a>
</li>
</ul>
</section>
I have created a layout for my project but I can't seem to get it right.
In this picture you see that my page-wrapper don't stretch the 100% window height. It just wrap around what is inside.
I have also created a JSFiddle that you can check out. I can easily add min-height to my #page-wrapper but then on some screens a scroll will come up and on other screens the same problem occurs. min-hieght or height set to 100% doesn't work.
And then I also want the top-nav and side-bar remain fixed to the screen so that only the white area become scrollable. The image below show what I want to achieve in the end.
How can I fix this or what is the most efficient way to get this layout?
HTML:
<div id="wrapper">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Purchase Module</a>
</div>
<ul class="nav navbar-top-links navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><i class="fa fa-user fa-fw"></i> User Profile
</li>
<li class="divider"></li>
<li><i class="fa fa-sign-out fa-fw"></i> Logout
</li>
</ul>
</li>
</ul>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</li>
<li>
<i class="fa fa-angle-double-right"></i> Dashboard
</li>
<li>
<i class="fa fa-angle-double-right"></i> Orders
</li>
<li>
<i class="fa fa-angle-double-right"></i> Vendors
</li>
</ul>
</div>
</div>
</nav>
<div id="page-wrapper">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<span class="navbar-brand" href="#">Vendors</span>
</div>
<ul class="nav navbar-nav navbar-right">
<li><i class="fa fa-plus-circle"></i> Add new</li>
</ul>
</div>
</nav>
<table id="index-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Contact Person</th>
<th>Phone Number</th>
<th>Email Address</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Tellus LLC</td>
<td>Nigel Chaney</td>
<td>070 8741 7876</td>
<td>nec.diam.Duis#felisNulla.com</td>
<td>
<div class="btn-group btn-group-xs" role="group">
<a class="btn btn-default" href="#" role="button">
<i class="fa fa-search-plus"></i> Show
</a>
<a class="btn btn-default" href="#" role="button">
<i class="fa fa-pencil-square-o"></i> Edit
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
CSS:
body {
background-color: #f8f8f8;
}
#wrapper {
width: 100%;
}
#page-wrapper {
padding: 15px;
background-color: #fff;
}
#media(min-width:768px) {
#page-wrapper {
position: inherit;
margin: 0 0 0 250px;
padding: 15px;
border-left: 1px solid #e7e7e7;
}
}
.navbar-top-links {
margin-right: 0;
}
.navbar-top-links li {
display: inline-block;
}
.navbar-top-links li:last-child {
margin-right: 15px;
}
.navbar-top-links li a {
padding: 15px;
min-height: 50px;
}
.navbar-top-links .dropdown-menu li {
display: block;
}
.navbar-top-links .dropdown-menu li:last-child {
margin-right: 0;
}
.navbar-top-links .dropdown-menu li a {
padding: 3px 20px;
min-height: 0;
}
.navbar-top-links .dropdown-menu li a div {
white-space: normal;
}
.navbar-top-links .dropdown-messages,
.navbar-top-links .dropdown-tasks,
.navbar-top-links .dropdown-alerts {
width: 310px;
min-width: 0;
}
.navbar-top-links .dropdown-messages {
margin-left: 5px;
}
.navbar-top-links .dropdown-tasks {
margin-left: -59px;
}
.navbar-top-links .dropdown-alerts {
margin-left: -123px;
}
.navbar-top-links .dropdown-user {
right: 0;
left: auto;
}
.sidebar .sidebar-nav.navbar-collapse {
padding-right: 0;
padding-left: 0;
}
.sidebar .sidebar-search {
padding: 15px;
}
.sidebar ul li {
border-bottom: 1px solid #e7e7e7;
}
.sidebar ul li a.active {
background-color: #eee;
}
.sidebar .arrow {
float: right;
}
.sidebar .fa.arrow:before {
content: "\f104";
}
.sidebar .active>a>.fa.arrow:before {
content: "\f107";
}
.sidebar .nav-second-level li,
.sidebar .nav-third-level li {
border-bottom: 0!important;
}
.sidebar .nav-second-level li a {
padding-left: 37px;
}
.sidebar .nav-third-level li a {
padding-left: 52px;
}
#media(min-width:768px) {
.sidebar {
z-index: 1;
position: absolute;
width: 250px;
margin-top: 51px;
}
.navbar-top-links .dropdown-messages,
.navbar-top-links .dropdown-tasks,
.navbar-top-links .dropdown-alerts {
margin-left: auto;
}
}
DataTables:
$(document).ready(function() {
$('#index-table').DataTable();
});
To achieve the layout you're after in your second image you can do something like this:
HTML
<html>
<body>
<div class="page-content">Content</div>
<div class="side-bar">Sidebar</div>
<div class="site-header">Header</div>
</body>
</html>
CSS
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.page-content {
height: 100%;
background: white;
padding: 80px 0 0 200px;
}
.site-header {
position: fixed;
top: 0;
left: 0;
height: 80px;
width: 100%;
background: yellow;
}
.side-bar {
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 200px;
background: green;
padding: 80px 0 0 0;
}
Fiddle: https://jsfiddle.net/0s3k9kho/
html, body, #wrapper {
height: 100%;
}
#page-wrapper {
min-height: calc(100% - 51px)
}
This works for me.