not very good at css need fixes to match my old code - html

I have been working on this game for a while and decided to change my navbars to just buttons and I'm having trouble finishing up matching my style i had.
old code fiddle : https://jsfiddle.net/tmanrocks999/L4hmpan1/38/
new code that i think is almost done : https://jsfiddle.net/tmanrocks999/yfcdqu5g/ ( can't get the last few things to work. not sure what the tab-container etc things need to say to make them work)
I basically want how my first fiddle looks on the 2nd one. its alot to post in here but i can post the css for both
old css:
body {
margin: auto;
background: #efefef;
font-family: arial;
}
.nav_bar {
margin: auto;
border-bottom: 1px solid #000000;
width: 860px;
padding: 0 20px 0 20px;
height: 64px;
margin-top: 30px;
}
.nav_bar ul {
padding: 0;
list-style: none;
}
.nav_bar ul li {
float: left;
font-size: 16px;
font-weight: bold;
margin-right: 5px;
}
.nav_bar ul li a {
text-decoration: none;
color: #000000;
background: #6db1e4;
border: 1px solid #000000;
border-bottom: none;
padding: 23px 20px 22px 20px;
-webkit-border-top-right-radius: 10px;
-webkit-border-top-left-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
width: 75px;
display: block;
text-align: center;
}
.nav_bar ul li a:hover {
text-decoration: none;
color: #000000;
background: #96e0e9;
-moz-transition: background-color 200ms ease-in;
-webkit-transition: background-color 200ms ease-in;
-ms-transition: background-color 200ms ease-in;
-o-transition: background-color 200ms ease-in;
transition: background-color 200ms ease-in;
}
.nav_bar ul li a#onlink {
background: #ffffff;
color: #000000;
border-bottom: 1px solid #ffffff;
}
.nav_bar ul li a#onlink:hover {
background: #ffffff;
color: #000000;
}
.main_container {
margin: auto;
width: 860px;
padding: 20px;
border: 1px solid #000000;
min-height: 400px;
border-top: none;
background: #ffffff;
}
.main_container p {
font-size: 14px;
margin: 0;
padding: 0;
}
starting of the new css that i will use once done because it works with buttons:
body {
margin: auto;
background: #efefef;
font-family: arial;
}
/* remove border radius for the tab */
/* change border radius for the tab , apply corners on top*/
#exTab3 .nav-pills {
margin: auto;
border-bottom: 1px solid #000000;
width: 860px;
padding: 0 20px 0 20px;
height: 64px;
margin-top: 30px;
}
#exTab3 .nav-pills>li>a {
text-decoration: none;
color: #000000;
background: #6db1e4;
border: 1px solid #000000;
border-bottom: none;
padding: 23px 20px 22px 20px;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
border-radius-topleft: 10px;
border-radius-topright: 10px;
width: 115px;
display: block;
text-align: center;
}
#exTab3 .tab-content {
margin: auto;
width: 860px;
padding: 20px;
border: 1px solid #000000;
min-height: 400px;
border-top: none;
background: #ffffff;
}
I expect my 2nd fiddle to match my first fiddle in css style. i figured out that navbars = a list of links so what i did find to work should work . Active tab should be white and other non active tabs blue. But my actual output is close to my old style but not exactly. If i could get some help with fixing my css id really appreciate it. been wanting this fix for a few months now.

You need to add below CSS to your code.
#exTab3 .nav-pills>li.active>a,
#exTab3 .nav-pills>li.active>a:hover,
#exTab3 .nav-pills>li.active>a:focus {
background-color: #fff !important;
}

Related

Active class now work corretly in HTML

I have a problem in my html. I can't find how can i solve it.
[class="active" then Home mark with red underline. default][1]
[When i click, red underline disappered][2]
[When i click anywhere, it is come again][3]
/*input[type=text] {
width: 40px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url('glyphicons-28-search.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 25px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
margin-left: 10px;
}*/
input[type=text] {
width: 130px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url('glyphicons-28-search.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 10px 10px 40px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
margin-left: 10px;
margin-bottom: 0px;
}
input[type=text]:focus {
/*border: 2px solid #FF0000;*/
}
body {
font: 400 15px Lato, sans-serif;
line-height: 1.8;
color: #818181;
background-color: #d9d9d9;
}
h2 {
font-size: 24px;
text-transform: uppercase;
color: #303030;
font-weight: 600;
margin-bottom: 30px;
}
h4 {
font-size: 19px;
line-height: 1.375em;
color: #303030;
font-weight: 400;
margin-bottom: 30px;
}
.container{
width: 100%;
margin: auto;
}
.navbar {
margin-bottom: 0;
border: 0;
font-size: 15px !important;
line-height: 1.42857143 !important;
letter-spacing: 1px;
border-radius: 0;
background-color: white;
padding: 30px 30px 30px 30px;
}
.navbar .navbar-nav {
display: inline-block;
float: none;
border-color: white;
}
.navbar-nav li a:hover, .navbar-nav li.active a{
border-bottom: 2px solid red;
color: black !important;
background-color: white !important;
}
.navbar .navbar-collapse {
text-align: center;
}
.center {
width: 100%;
margin: 10px 50px 0px 50px;
}
.right {
float: right;
margin-right: 130px;
margin-left: 260px;
}
.top {
margin-top: 150px;
}
.img {
padding-right: 50px;
width: 80%;
}
Thanks for helping!
Just add this CSS :
.navbar-nav li.active a:focus{
border-bottom: 2px solid red;
}
if this not works then just add important :
.navbar-nav li.active a:focus{
border-bottom: 2px solid red !important;
}

Why is this scrollbar greyed out when the content definitely goes off the page?

I'm developing a Web Application at the moment and I recently added a scrollbar to the sidebar on my application. However even though the content goes off the page at the bottom, the scrollbar never seems to become active?
Here is a codepen showing the issue:
http://codepen.io/RBrNx/pen/MbBYPZ
and here is my CSS:
.nav-side-menu {
overflow: hidden;
font-size: 18px;
font-weight: 100;
border-right: 1px solid #484848;
background-color: #e6e6e6;
position: fixed;
top: 0px;
width: 20%;
height: 100%;
color: #484848;
}
.nav-side-menu .brand {
background-color: #e6e6e6;
line-height: 75px;
display: block;
text-align: center;
font-size: 32px;
border-bottom: 1px solid #484848;
}
.chat-header {
position: fixed;
left: 20%;
width: 80%;
background-color: #e6e6e6;
line-height: 75px;
display: block;
text-align: center;
font-size: 32px;
border-bottom: 1px solid #484848;
}
.nav-side-menu .toggle-btn {
display: none;
}
.nav-side-menu ul,
.nav-side-menu li {
list-style: none;
padding: 0px;
margin: 0px;
line-height: 80px;
cursor: pointer;
}
.nav-side-menu ul :not(collapsed) .arrow:before,
.nav-side-menu li :not(collapsed) .arrow:before {
/*font-family: FontAwesome;*/
content: "\f078";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
float: right;
}
.nav-side-menu ul .active,
.nav-side-menu li .active {
background-color: #3ab795;
}
.nav-side-menu li {
padding-left: 0px;
border-bottom: 1px solid #484848;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.nav-side-menu li a {
padding-left: 20px;
padding-top: 29px;
padding-bottom: 29px;
padding-right: 100%;
text-decoration: none;
color: #484848;
}
.nav-side-menu li a i {
padding-left: 10px;
width: 20px;
padding-right: 20px;
}
.nav-side-menu li:hover {
background-color: #3ab795;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
input[type=text]{
width: 100%;
position: relative;
margin: 5px 0 5px 0;
padding: 3px 10px 3px 20px;
box-sizing: border-box;
border: 1px solid #484848;
border-radius: 20px;
background-color: #e6e6e6;
}
.search-menu{
border-bottom: 1px solid #484848;
padding: 5px;
}
#media (max-width: 767px) {
.nav-side-menu {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.nav-side-menu .toggle-btn {
display: block;
cursor: pointer;
position: absolute;
right: 20px;
top: 5px;
z-index: 10 !important;
padding: 3px;
background-color: #e6e6e6;
color: #484848;
width: 30px;
text-align: center;
}
.brand {
text-align: left !important;
font-size: 22px;
padding-left: 20px;
line-height: 50px !important;
}
}
#media (min-width: 767px) {
.nav-side-menu .menu-list .menu-content {
display: block;
}
}
body {
margin: 0px;
padding: 0px;
font-family: 'Roboto', sans-serif;
}
You'll also notice that if you type, for example: '2', into the Search box, the scrollbar will still display even though there are only 2 items displayed. Is there a way to stop it appearing when it isn't necessary?
Thanks!
Firstly its important to understand what does position: fixed do to your element.
When you fix a position of an element it will hypothetically "pull" that element out of the document - meaning its not part of the document anymore. Another way to put it is it will ignore all elements around it including its container
In your case it means it will not bring the scroll because simply it does not know it has to(since it ignores its container it does not know what is its height & such), hence you need to specifically give it a height for it to bring the scroll.
Adding the simple below CSS would do the trick.
#menu-content {
height: 500px; /*or the height you want*/
}
All that explanation was not needed but I thought you should know that sometimes overusing fixed could be complicated.

How can I get these two divs to appear close to each other vertically?

a bit new to web development so bear with me. As you can see in the Codepen I've made here, I am developing a prototype messaging client. I'd like the Chat Name and the Preview Text to be one under the other, really close like in the image here. I'd also like to have another Div/Span at the end of the the button that will have some inner text as well, like in the image where it says "Now".
Here's my CSS for reference, how can I get the two (three, really) divs to be in the correct place.
.nav-side-menu {
overflow: hidden;
font-size: 18px;
font-weight: 100;
border-right: 1px solid #484848;
background-color: #e6e6e6;
position: fixed;
top: 0px;
width: 20%;
height: 100%;
color: #484848;
}
.nav-side-menu .brand {
background-color: #e6e6e6;
line-height: 75px;
display: block;
text-align: center;
font-size: 32px;
border-bottom: 1px solid #484848;
}
.chat-header {
position: fixed;
left: 20%;
width: 80%;
background-color: #e6e6e6;
line-height: 75px;
display: block;
text-align: center;
font-size: 32px;
border-bottom: 1px solid #484848;
}
.nav-side-menu .toggle-btn {
display: none;
}
.nav-side-menu ul,
.nav-side-menu li {
list-style: none;
padding: 0px;
margin: 0px;
line-height: 80px;
cursor: pointer;
}
.nav-side-menu ul :not(collapsed) .arrow:before,
.nav-side-menu li :not(collapsed) .arrow:before {
/*font-family: FontAwesome;*/
content: "\f078";
display: inline-block;
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
float: right;
}
.nav-side-menu ul .active,
.nav-side-menu li .active {
background-color: #3ab795;
}
.nav-side-menu li {
padding-left: 0px;
border-bottom: 1px solid #484848;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.nav-side-menu li a {
padding-left: 20px;
padding-top: 29px;
padding-bottom: 29px;
padding-right: 100%;
text-decoration: none;
color: #484848;
}
.nav-side-menu li a i {
padding-left: 10px;
width: 20px;
padding-right: 20px;
}
.nav-side-menu li:hover {
background-color: #3ab795;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#searchbox{
width: 100%;
position: relative;
margin: 5px 0 5px 0;
padding: 3px 10px 3px 20px;
box-sizing: border-box;
border: 1px solid #484848;
border-radius: 20px;
background-color: #e6e6e6;
}
.search-menu{
border-bottom: 1px solid #484848;
padding: 5px;
}
.chat-box{
position: fixed;
bottom: 0;
width: 80%;
height: 60px;
left: 20%;
background-color: #e6e6e6;
border-top: 1px solid #484848;
}
#message-box{
width: 95%;
position: relative;
margin: 15px 5px 5px 5px;
padding: 3px 10px 3px 20px;
border: 1px solid #484848;
border-radius: 20px;
background-color: #e6e6e6;
}
.send-message{
background-color: #3ab795;
width: 3%;
height: 30px;
border-radius: 5px;
border: none;
}
.send-message:focus{
outline: 0;
}
.send-message:active{
background-color: #29a281;
}
.preview-text{
font-size: 11px;
}
#media (max-width: 767px) {
.nav-side-menu {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.nav-side-menu .toggle-btn {
display: block;
cursor: pointer;
position: absolute;
right: 20px;
top: 5px;
z-index: 10 !important;
padding: 3px;
background-color: #e6e6e6;
color: #484848;
width: 30px;
text-align: center;
}
.brand {
text-align: left !important;
font-size: 22px;
padding-left: 20px;
line-height: 50px !important;
}
}
#media (min-width: 767px) {
.nav-side-menu .menu-list .menu-content {
display: block;
}
}
body {
margin: 0px;
padding: 0px;
font-family: 'Roboto', sans-serif;
}
.nano { height: 85%; }
.nano .nano-pane { background: #888; }
.nano .nano-slider { background: #111; }
http://codepen.io/djkantoci/pen/KNGYbv
Change line-height to 1.5 (or some other value, but don't use pixels).
Add some padding-right to li (to make space for time text), append time and add position: absolute to that time div (don't forget to make li element relative)
Your code is pretty much right. Because of line height, that element getting so much height. Please have a look at below code.
.nav-side-menu ul,
.nav-side-menu li{
line-height: normal;
}
.nav-side-menu li> div {
padding: 5px 12px;
}
Adjust the line height on your nav-side-menu elements
.nav-side-menu ul,
.nav-side-menu li {
list-style: none;
padding: 0px;
margin: 0px;
line-height: 30px;
cursor: pointer;
}

Rounded Box not working CSS

I tried to round the corners on this div box that I created and it doesn't work. Tested this out on Chrome, IE, Firefox and no go. I am not too fluent in CSS and DIV. So if you can see my problem, please help me.
Code CSS:
.side-nav-menu{
width: 100%;
border-radius: 10px;
}
.side-nav-menu h1{
font-size: 1.1em;
font-weight:bold;
color: white;
background: #3F5671;
margin-bottom: 0;
padding: 7px 0 7px 7px;
}
.side-nav-menu ul{
list-style-type: none;
margin: 0;
padding: 0;
border-left: 1px solid #c0c0c0;
border-right: 1px solid #c0c0c0;
margin-bottom: 0;
}
.side-nav-menu ul li{
padding-bottom: 0px;
border-bottom: 1px solid #c0c0c0;/
}
.side-nav-menu ul li a{
font-size: normal 1.1em;
font-weight:bold;
color: #777777;
background: #ffffff;
display: block;
padding: 5px 0;
line-height: 17px;
padding-left: 7px;
text-decoration: none;
}
.side-nav-menu ul li a:hover{
color: #777777;
background: #F7F7F7;
}
HTML
<div class="side-nav-menu">
<h1>Sub-Categories</h1>
<ul>
<li>Air Sampling Pumps</li>
<li>Dust Monitors</li>
<li>Flame Ionization Detectors</li>
<li>Photoionization Detectors</li>
<li>Ventilation Blower</li>
</ul>
</div>
https://jsfiddle.net/pssz0xv0/
Child elements wont inherit round corners from their parents. You will have to apply a border radius to the top element 'h1' and bottom element, the last 'a'.
https://jsfiddle.net/pssz0xv0/5/
.side-nav-menu h1{
border-radius:10px 10px 0 0;
}
.side-nav-menu ul li:last-child a{
border-radius: 0 0 10px 10px;
}
border-radius: 10px
On .side-nav-menu ?
.side-nav-menu{
width: 100%;
border-radius: 10px;
overflow: hidden;
}
.side-nav-menu h1{
font-size: 1.1em;
font-weight:bold;
color: white;
background: #3F5671;
//margin-bottom: 0;
margin: 0;
padding: 7px 0 7px 7px;
}
https://jsfiddle.net/alireza_safian/pssz0xv0/9/

CSS style does not render offscreen elements with styles

I've having problems rending off screen elements properly. I believe the problem has to do with overflow properties. If I view the browser at full screen(1080p) its fine, but when I resize the browser to a smaller resolution, and then SCROLL down, the styles disappear for off screen elements.
EDIT [ Removed links to prevent broken links in the future ]
/* DEFAULT */
* {
margin: 0px;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
}
#font-face {
font-family: leela;
src: url('leelawad_0.ttf');
}
html, body {
height: 100%;
background-color: rgb(255,255,255);
}
h1 {
color: rgb(183,183,183);
font-family: leela;
font-size: 16px;
font-weight: normal;
text-transform: uppercase;
}
a {
color: rgb(102,102,102);
text-decoration: none;
}
/* ID */
#container {
height: 100%;
overflow-x: hidden;
width: 100%;
}
#header {
border: 1px solid rgb(153,153,153);
border-top: 0px;
background-color: rgb(255,255,255);
padding: 8px;
position: fixed;
width: 100%;
z-index: 3;
}
#quickSearch {
border: 1px solid rgb(153,153,153);
background-color: rgb(250,250,250);
height: 30px;
margin: 8px 8px 8px 8px;
}
#quickSearch input {
background-color: rgb(250,250,250);
border: 0px;
height: 28px;
margin-left: 10px;
margin-top: 0px;
float: left;
}
#naviContainer {
float: left;
width: 200px;
border-right: 1px solid rgb(153,153,153);
background-color: rgb(225,225,225);
height: 100%;
}
#navigation {
background-color: rgb(225,225,225);
float: left;
width: 200px;
margin-top: 31px;
position: relative;
z-index: 2;
height: 100%;
}
#navigation ul {
margin: 0px;
padding: 0px;
width: 200px;
}
#navigation li {
display: block;
list-style-type: none;
-webkit-transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-o-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
}
#navigation li:hover {
background-color: rgb(173,173,173);
-webkit-transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-o-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
}
#navigation h1 {
border-bottom: 1px dotted rgb(153,153,153);
background-color: rgb(127,127,127);
padding: 8px;
}
#navigation h1.fix {
border-top: 1px dotted rgb(153,153,153);
}
#navigation ul li {
border-bottom : 1px dotted rgb(153,153,153);
}
#navigation li a {
display: block;
padding: 8px;
}
#contentContainer {
margin-left: 201px;
margin-top: 31px;
position: relative;
}
#breadcrumbs {
background-color: rgb(239,239,239);
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: rgb(153,153,153);
padding: 8px;
position: inherit;
}
#breadcrumbs ul {
display: inline;
margin-left: 0px;
padding: 0px;
}
#breadcrumbs li {
display: inline;
}
#content {
padding: 8px;
position: inherit;
}
/* CLASSES */
.divider {
border-left: solid 1px rgb(102,102,102);
margin: 0px 7px 0px 5px;;
}
Any input would be greatly appreciated!
Try adding using position:fixed (I made it yellow so it would stand out):
#navigation {
background-color: yellow;
border-right: 1px solid #999999;
border-top: 0 none;
float: left;
height: 100%;
margin-top: 31px;
position: fixed;
width: 200px;
z-index: 2;
}
[Edit] 2nd attempt, remove height.
#navigation {
background-color: #E1E1E1;
float: left;
//height: 100%;
margin-top: 31px;
position: relative;
width: 200px;
z-index: 2;
}
that was nothing more then height:100% issue
Remove height:100% from #naviContainer will fix this.
#navigation {
background-color: #E1E1E1;
float: left;
min-height: 100%;
margin-top: 31px;
position: relative;
width: 200px;
z-index: 2;
}
#naviContainer {
background-color: #E1E1E1;
border-right: 1px solid #999999;
float: left;
min-height: 100%; /* the fix */
width: 200px;
}