I'm fairly new to CSS so if someone can help me I'd be very appreciative!!!
I need to make a dropdown menu that drops up not down, since the nav bar is at the bottom of the page.
Here is the CSS for the nav bar
* 5. Navigation *
************************************************/
#navigation {
background: #000000;
height: 30px;
width: 100%;
font-size: 0.8em;
font-family: Arial, Helvetica, sans-serif;
font-style: normal;
color: #666666;
font-weight: normal;
margin: 0px auto 1px;
padding: 0px 0px 0px 0px;
position: relative;
z-index: 9;
}
/*** ESSENTIAL STYLES ***/
.menu, .menu * {
margin: 0;
padding: 0;
list-style: none;
}
.menu {
line-height: 1.0;
}
.menu ul {
margin: 0px;
padding: 0px;
}
.menu ul ul, ul.menu ul {
position: absolute;
top: -9999px;
width: 180px; /* left offset of submenus need to match (see below) */
}
.menu ul li ul li, ul.menu ul li {
width: 100%;
border: none;
margin: 0px 0px 0px 0px;
}
.menu li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
}
.menu li {
float: left;
position: relative;
}
.menu a {
display: block;
position: relative;
}
.menu li:hover ul,
.menu li.sfHover ul {
left: 0;
top: 30px; /* match top ul list item height */
z-index: 99;
}
ul.menu li:hover li ul,
ul.menu li.sfHover li ul {
top: -9999px;
}
ul.menu li li:hover ul,
ul.menu li li.sfHover ul {
left: 180px; /* match ul width */
top: 0;
}
ul.menu li li:hover li ul,
ul.menu li li.sfHover li ul {
top: -9999px;
}
ul.menu li li li:hover ul,
ul.menu li li li.sfHover ul {
left: 180px; /* match ul width */
top: 0;
}
/*** SKIN ***/
#navigation .menu .current_page_item a,
#navigation .menu .current_page_ancestor a,
#navigation .menu .current-menu-item a,
#navigation .menu .current-cat a {
background: #000000;
color: #FFFFFF;
}
#navigation .menu li .current_page_item a, #navigation .menu li .current_page_item a:hover,
#navigation .menu li .current-menu-item a, #navigation .menu li .current-menu-item a:hover,
#navigation .menu li .current-cat a, #navigation .menu li .current-cat a:hover {
background: #242424;
color: #FFFFFF;
}
#navigation .menu .current_page_item ul li a,
#navigation .menu .current-menu-item ul li a,
#navigation .menu .current-menu-ancestor ul li a,
#navigation .menu .current_page_ancestor ul li a,
#navigation .menu .current-cat ul li a {
background: #FFFFFF;
color: #333333;
}
#navigation .menu .current_page_item ul li a:hover,
#navigation .menu .current-menu-item ul li a:hover,
#navigation .menu .current-menu-ancestor ul li a:hover,
#navigation .menu .current_page_ancestor ul li a:hover,
#navigation .menu .current-menu-ancestor ul .current_page_item a,
#navigation .menu .current_page_ancestor ul .current-menu-item a,
#navigation .menu .current-cat ul li a:hover {
background: #F2F2F2;
color: #000000;
}
#navigation .menu .current_page_item .sub-menu a,
#navigation .menu .current_page_ancestor .sub-menu a,
#navigation .menu .current-menu-item .sub-menu a,
#navigation .menu .current-cat .sub-menu a {
background: #FFFFFF;
color: #333333;
}
#navigation .menu .current_page_item .sub-menu a:hover,
#navigation .menu .current_page_ancestor .sub-menu a:hover,
#navigation .menu .current-menu-item .sub-menu a:hover,
#navigation .menu .current-cat .sub-menu a:hover {
background: #F2F2F2;
color: #000000;
}
.menu {
float: left;
margin-bottom: 0;
}
.menu a {
background: #000000;
text-decoration: none;
font-style: normal;
font-weight: normal;
line-height: 30px;
margin: 0px 1px 0px 0px;
padding: 0px 10px 0px 10px;
}
.menu a, .menu a:link, .menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
color: #999999;
}
.menu a:focus, .menu a:hover, .menu a:active {
background: #000000;
color: #FFFFFF;
outline: 0;
}
.menu li li a, .menu li li a:link, .menu li li a:visited {
background: #FFFFFF;
color: #666666;
margin: 0px;
padding: 0px 10px 0px 10px;
text-decoration: none;
text-transform: none;
text-shadow: none;
border: none;
}
.menu li li a:focus, .menu li li a:hover, .menu li li a:active {
background: #F2F2F2;
color: #333333;
border-bottom: none;
outline: 0;
}
.menu li.sfHover a {
background: #FFFFFF;
color: #333333;
}
.menu li {
margin: 0px;
}
.menu li li {
border: none;
}
.menu li:hover, .menu li.sfHover {
background: none;
border-bottom: none;
outline: 0;
}
.menu li li:hover, .menu li li.sfHover {
padding: 0px;
border: none;
outline: 0;
}
/*** ARROWS **/
.menu a.sf-with-ul {
padding-right: 25px;
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
}
.sf-sub-indicator {
position: absolute;
display: block;
right: 10px;
top: 9px; /* IE6 only */
width: 10px;
height: 10px;
text-indent: -9999px;
overflow: hidden;
background: url(images/arrows-ffffff.png) no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
}
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: 9px;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator,
a:hover > .sf-sub-indicator,
a:active > .sf-sub-indicator,
li:hover > a > .sf-sub-indicator,
li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
/* point right for anchors in subs */
.menu ul ul .sf-sub-indicator, ul.menu ul .sf-sub-indicator {
background-position: -10px 0;
}
.menu ul ul a > .sf-sub-indicator, ul.menu ul a > .sf-sub-indicator {
top: 8px;
background-position: 0 0;
}
/* apply hovers to modern browsers */
.menu ul ul a:focus > .sf-sub-indicator,
.menu ul ul a:hover > .sf-sub-indicator,
.menu ul ul a:active > .sf-sub-indicator,
.menu ul ul li:hover > a > .sf-sub-indicator,
.menu ul ul li.sfHover > a > .sf-sub-indicator {
background-position: -10px 0; /* arrow hovers for modern browsers*/
}
/*** shadows for all but IE6 ***/
.sf-shadow ul ul {
background: none;
padding: 0 8px 9px 0;
-moz-border-radius-bottomleft: 17px;
-moz-border-radius-topright: 17px;
-webkit-border-top-right-radius: 17px;
-webkit-border-bottom-left-radius: 17px;
}
.sf-shadow ul.sf-shadow-off {
background: transparent;
}
Here is a post with 3 demos of upward expanding drop-downs. They've even added a jsFiddle :)
can you maybe provide a link to the live code so i can see exactly how its set up, or you can add the html in to your question too, then i'll be happy to help you.
meanwhile if you just whant a simple example here is one: Link to Drop up
Related
I want my ul to get the full height of the div but its not taking the divs entire height so I need to change the ul to take full height of the div
.header-wrapper {
display: inline-flex;
width: 100%;
height: 50px;
top: 0;
left: 0;
position: fixed;
background: linear-gradient(base.$secondaryColor, base.$primaryColor);
}
.top-nav-bar {
height: 100%;
float: right;
background-color: green;
li {
display: inline-flex;
list-style-type: none;
color: base.$whiteColor;
margin-left: 10px;
margin-right: 10px;
align-items: center;
justify-content: center;
background-color: red;
height: 50px;
width: 100px;
cursor: pointer;
&:hover {
color: base.$blackColor;
background-color: base.$whiteColor;
}
}
}
Here is my code
css is not working properly in rails 4.2.5 on implementing home page looks like
the gem file are
gem 'rails', '4.2.5.1'
gem 'pg'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'devise'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'bootstrap-sass', '3.2.0.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'coffee-script-source', '1.8.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
my routes are
Rails.application.routes.draw do
get 'pages/about'
get 'pages/contact'
get 'pages/resources'
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
resources :categories
get 'categories/index'
get 'categories/edit'
get 'categories/new'
get 'categories/show'
get 'home/index'
resources :posts
root 'home#index'
end
my css files are:
#import "bootstrap-sprockets";
#import "bootstrap";
body {
margin: 0;
padding: 0;
background: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #6F6F6F;
}
strong {
color: #3F3F3F;
}
h1,h2,h3 {
margin: 0;
padding: 0;
text-transform: uppercase;
font-family: 'Abel', sans-serif;
font-weight: normal;
color: #2B2522;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 2.8em;
}
h3 {
font-size: 1.6em;
}
p,ul,ol {
margin-top: 0;
line-height: 180%;
}
ul,ol {
}
a {
text-decoration: underline;
color: #D93544;
}
a:hover{
text-decoration: none;
}
#wrapper{
width: 1000px;
margin: 0 auto;
padding: 0;
background: #000000;
}
/* Header */
#header-wrapper {
height: 120px;
}
#header {
width: 1000px;
margin: 0 auto;
padding: 0px 0px 0px 0px;
}
/* Logo */
#logo {
float: left;
width: 350px;
margin: 0;
padding: 0;
color: #000000;
}
#logo h1, #logo p {
}
#logo h1 {
margin-left: 30px;
padding: 20px 0px 0px 0px;
letter-spacing: -1px;
text-transform: uppercase;
font-family: 'Abel', sans-serif;
font-size: 3.8em;
font-weight: bold;
color: #D43442;
}
#logo h1 a {
color: #D43442;
}
#logo h1 span {
}
#logo p {
margin: 0;
padding: 0px 0 0 32px;
font: normal 14px Georgia, "Times New Roman", Times, serif;
font-style: italic;
color: #BEBEBE;
}
#logo a {
border: none;
background: none;
text-decoration: none;
color: #707070
}
/* Search */
#search {
float: right;
width: 280px;
height: 60px;
padding: 20px 0px 0px 0px
}
#search form {
height: 41px;
margin: 0;
padding: 10px 0 0 0px;
}
#search fieldset {
margin: 0;
padding: 0;
border: none;
}
#search-text {
width: 170px;
height: 19px;
padding: 4px 5px 1px 5px;
border: none;
background: #FFFFFF;
text-transform: lowercase;
font: normal 11px Arial, Helvetica, sans-serif;
color: #5D781D;
}
#search-submit {
width: 50px;
height: 26px;
background: #D93544;
color: #FFFFFF;
}
/* Menu */
#menu {
float: right;
height: 125px;
margin: 0 auto;
padding: 0;
background: #D43442;
}
#menu ul {
margin: 0;
padding: 0px 0px 0px 0px;
list-style: none;
line-height: normal;
}
#menu li {
float: left;
border-left: 1px solid #000000;
}
#menu a {
display: block;
height: 80px;
padding: 45px 25px 0px 25px;
text-decoration: none;
text-align: center;
text-transform: uppercase;
font-family: 'Abel', sans-serif;
font-size: 26px;
font-weight: normal;
color: #FFFFFF;
border: none;
}
#menu a:hover, #menu .current_page_item a{
background: #A32833;
text-decoration: none;
}
#menu .current_page_item a {
}
/* Page */
#page {
width: 980px;
margin: 0 auto;
padding: 0px 0px 0px 20px;
}
#page-bgtop {
padding: 20px 0px;
}
/* Content */
#content {
float: right;
width: 600px;
padding: 40px 0px 0px 0px;
}
.post, .post_full, .page {
margin-bottom: 30px;
padding: 30px 20px 20px 20px;
background: #FFFFFF url (images/page-gradient-bg.png) repeat-x left bottom;
box-shadow: inset 0px 0px 1px 1px rgba(255,255,255,1);
outline: 1px dashed #D4D4D4;
outline-offset: -5px;
}
.post .title, .page .title {
height: 41px;
padding: 0px 0px 0px 0px;
letter-spacing: -1px;
font-family: 'Abel', sans-serif;
}
.post .title a, .page .title a {
text-decoration: none;
color: #202020;
border: none;
}
.post .entry {
padding: 20px 30px 20px 30px;
padding-bottom: 20px;
text-align: justify;
}
.post .byline {
clear: both;
overflow: hidden;
padding-bottom: 20px;
}
.post .meta {
float: left;
}
.post .links {
float: right;
}
/* Full Post */
.post_full .byline p {
padding: 0;
margin: 0;
}
.post_full .byline {
clear: both;
overflow: hidden;
margin-bottom: 15px;
padding: 5px;
background: black:;
color: #fff;
border-left: 5px #D93544 solid;
}
.links a {
}
/* Sidebar */
#sidebar {
float: left;
width: 300px;
margin: 0px;
padding: 20px 20px 0px 0px;
}
#sidebar ul {
margin: 0;
padding: 0;
list-style: none;
}
#sidebar li {
margin: 0;
padding: 0;
}
#sidebar li ul {
margin: 0px 0px;
padding-bottom: 30px;
}
#sidebar li li {
line-height: 35px;
border-bottom: 1px dashed #191919;
background: url (images/img01.jpg) no-repeat left 15px;
margin: 0px 20px 0px 20px;
border-left: none;
text-align: left;
}
#sidebar li li span {
display: block;
margin-top: -20px;
padding: 0;
font-size: 11px;
font-style: italic;
}
#sidebar li li a {
padding: 0px 0px 0px 0px;
}
#sidebar h2 {
height: 31px;
margin: 0px 0px 0px 0px;
padding: 10px 0px 0px 20px;
background: url(images/img03.jpg) no-repeat left top;
text-shadow: #203060 -1px 1px 2px;
text-align: left;
text-transform: uppercase;
letter-spacing: -0.5em;
font-size: 2em;
color: #FFFFFF;
}
#sidebar p {
margin: 0 0px;
padding: 0px 20px 20px 20px;
text-align: justify;
color: #847F7E;
}
#sidebar a {
border: none;
color: #847F7E;
}
#sidebar a:hover {
text-decoration: underline;
color: #847F7E;
}
/* Calendar */
#calender {
}
#calender_wrap{
padding:20px;
}
#calender table {
width: 100%;
}
#calendar body td {
text-align: center;
}
#calendar #next {
text-align: right;
}
/footer/
#footer{
width: 980px;
height: 50px;
margin: 0 auto;
padding: 0px 0 15px 0;
font-family: Arial, Helvetica, sans-serif;
}
#footer p {
margin: 0;
line-height: normal;
font-size: 10px;
text-transform: uppercase;
text-align: center;
color: #847F7E;
}
#footer a {
color: 847F7E;
}
form label{width: 110px; display: inline-block;}
looks like thisenter image description here
want home about contact to be in column form
and want to remove the header background
So I'm making a website for a school assessment, and I was wondering why my Nav bar links are always slightly below the actual nav bar itself. If anyone could help that'd be great :).
ul {
text-align: center;
padding-left: 1px;
top: -10px;
list-style: none;
}
ul li {
font-family: Arial;
font-size: 15px;
font-weight: bold;
display: inline-block;
margin-right: -4px;
position: 0px;
padding: 10px 89.5px;
background-color: #6C2DC7;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
transition: all 0.2s;
}
ul li:hover {
background: #8467D7;
}
a:link {color:#FFFFFF;} /* unvisited link */
a:visited {color:#FFFFFF;} /* visited link */
a:hover {color:#FFFFFF;} /* mouse over link */
a:active {color:#FFFFFF;} /* selected link */
a {
text-decoration: none;
}
This is what it looks like on my website.
If you change this it will work:
line 75 of your style.css
ul {
text-align: center;
top: 0px;
list-style: none;
margin-top: -5px;
}
really you should make this just for your nav bar and not for every ul so you could change it to the below: up to you though both ways work :)
#navigation ul {
text-align: center;
top: 0px;
list-style: none;
margin-top: -5px;
}
How to set transition delay on li:after so that it aligns with transition for li:hover? Seems like it doesn't work when transition: all 0.3s; is set, because it appears instantly.
Here is the Fiddle
Maybe if you do something like this, where you first set up the :after and then show it on :hover
body {
background-color: #f01;
}
ul {
background-color: #fff;
}
li {
position: relative;
list-style-type: none;
display: inline;
line-height: 2em;
padding: 5px;
transition: all 1s;
}
li:hover {
background-color: #414C52;
transition: all 1s;
}
li:after {
top: 25px;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(136, 183, 213, 0);
border-top-color: #414C52;
margin-left: -10px;
transition: all 1s;
border-width: 10px;
opacity: 0;
}
li:hover:after {
opacity: 1;
transition: all 1s;
}
a {
padding: 12px 10px color: #333;
}
<ul class="nav navbar-nav">
<li>asdfasdf</li>
<li class="active">ffffft</li>
</ul>
yes, it should do it but you need an inital li:after before your li:hover:after
I'm trying to use the CSS3 pseudo :after on li elements. The issue is that the content of :after is immediately following the li content - as if :after uses text-align:left; But since my li elements use display:block; shouldn't using text-align:right; on :after move the :after content all the way to the right? It doesn't anyway.
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
}
.container ul li:after {
content: ">";
text-align: right;
}
This is a screen shot of the issue:
I want the > to be all the way at the right, and since the content of the li changes, I can't set a width on the :after content.
How would I get the :after content to align to the right, if not with text-align?
Try float :
.container ul li:after {
content: ">";
text-align: right;
float:right;
}
Demo http://jsfiddle.net/surN2/
Hey now you can used position properties as like this:
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
position:relative;
}
.container ul li:after {
content: ">";
position:absolute;
left:20px;
top:5px;
}
and change to css properties according your design.
Live demo: http://tinkerbin.com/yXzOyDNg
If you want to right align than change left into right
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
}
.container ul li:after {
content: ">";
position:absolute;
right:20px;
top:5px;
}
Live demo: http://tinkerbin.com/rSWKxLwX
Use float:right and special line-height for vertical alignment.
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
width: 100%;
}
.container ul li:after {
content: ">";
float: right;
line-height: 12px;
}
Use display:flex and justify-content:space-between with align-items:center;
.container ul li {
display:flex;
justify-content:space-between;
align-items:center;
}
.container ul li:after {
content: ">";
}