I'm trying to make sub-menus for my menu, but something just isn't right and doesn't pop out like I want.
<div class="navbox">
<ul class="nav">
<li>Program</li>
<li><ul>
<li>Teknik</li>
<li>Naturvetenskap</li>
<li>El</li>
</ul></li>
</ul></div>
* { margin:0;
padding:0;
}
html {height: 100%;}
body{
position: relative;
height: 100%;
background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#fff));
}
.navbox {
position: relative;
float: left;
}
ul.nav {
list-style: none;
display: block;
width: 200px;
position: relative;
top: 100px;
left: 100px;
padding: 60px 0 60px 0;
background: url(shad2.png) no-repeat;
-webkit-background-size: 50% 100%;
display: inline-table;
}
li {
margin: 5px 0 0 0;
}
ul.nav li a {
-webkit-transition: all 0.3s ease-out;
background: #cbcbcb url(border.png) no-repeat;
color: #174867;
padding: 7px 15px 7px 15px;
-webkit-border-top-right-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
width: 100px;
display: block;
text-decoration: none;
-webkit-box-shadow: 2px 2px 4px #888;
}
ul.nav li :hover {
background: #ebebeb url(border.png) no-repeat;
color: #67a5cd;
padding: 7px 15px 7px 30px;
}
The problem with the code is that I want to get the link "Program" to display the submenus under, "Teknik" "Naturvetenskap" "El" but I just can't get them to pop out under. I can't get them to pop out at all, and that's all I need, I'll have to deal with design later.
Made it into a codepen for you - http://codepen.io/anon/pen/pxfKE - and tried to answer what I think you were looking for. It should be pretty self explanatory, but let me know if you need help understanding it :)
Related
I am trying to move mobile navigation from top left corner and slide in from left side to the right side. I've tried to change position settings from left to right, but it didn't work.
I will really appreciate any help!
Code below, thank you!
#wrapper {
position: absolute;
width: auto;
min-width: 60px;
height: 100%;
overflow: hidden;
margin: 0 auto;
padding: 0;
}
label {
cursor: pointer;
}
&:focus {
outline: none;
}
.menu {
position: absolute;
top: 0;
left: 0;
background: #fff;
width: 240px;
height: 100%;
transform: translate3d(-240px, 0, 0);
transition: transform 0.35s;
}
label.menu-toggle {
position: absolute;
right: -60px;
width: 60px;
height: 60px;
line-height: 0px;
display: block;
padding: 0;
text-indent: -9999px;
background: transparent url(https://cdn4.iconfinder.com/data/icons/wirecons-free-vector-icons/32/menu-alt-512.png) 50% 50% / 25px 25px no-repeat;
}
label.active {
background: transparent url(menu-cross.png) 50% 50% / 25px 25px no-repeat;
}
ul li>label {
background: url(https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-arrow-right-b-128.png) 95% 50% / 16px 16px no-repeat;
}
a,
label {
display: block;
text-align: left;
padding: 0 30px;
line-height: 60px;
text-decoration: none;
margin: 0 auto;
color: #000;
}
&:hover {
color: #666;
}
.menu-checkbox{
display: none;
}
.menu .menu label.menu-toggle {
background: none;
}
.menu-checkbox:checked + .menu {
transform: translate3d(0, 0, 0);
}
<div id="wrapper">
<input type="checkbox" id="menub" name="menu" class="menu-checkbox">
<div class="menu">
<label class="menu-toggle" for="menub"><span>Toggle</span></label>
<ul>
<li>
link
</li>
<li>
link
</li>
<li>
link
</li>
</ul>
</div>
</div>
<!-- #wrapper -->
I believe you have overcomplicated your task. You could simply open new project on visual studio and go from there. This would be the best option, since the result you want to achieve is most likely the same.
Now if you do want to stick to this, you must go carefully through your style code and what could be preventing the item to align on the right side.
If i write a very long article, bottom of the text goes behind the footer and cant be read, while the header (navbar) at the top shifts downwards. The footer is fixed. The header should stay where it is. However I can see that the text that i provide in the section basically wraps around the logo on the top left, while the navbar connected to the logo which is floated left shifts downwards, below the logo. stays above the navbar while the rest of the text () is below the navbar. I have been trying to fix it for hours but couldn't. Thanks for reading. If insufficient for answer, which parts of the HTML code do i have to provide? Thanks!
This is the CSS code.
*{
margin: 0;
padding: 0;
font-family: arial;
}
.container {
}
header,section,footer{
display: block;
}
.logo {
float: left;
width: 200px;
height: 100px;
}
.top_nav {
float: left;
width: 1400px;
height: 100px;
background-color: #0080ff;
}
.top_nav ul li {
float: left;
padding: 40px 20px;
list-style-type: none;
}
a:link {
color: white;
text-decoration: none;
}
a:hover {
background-color: #198cff;
}
a:visited{
color: white;
}
input.gobutton{
width:69%;
cursor:pointer;
padding:5px 25px;
background:#A87300;
border:1px solid #A87300;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0 0 4px rgba(0,0,0, .75);
-moz-box-shadow: 0 0 4px rgba(0,0,0, .75);
box-shadow: 0 0 4px rgba(0,0,0, .75);
color:#f3f3f3;
font-size:1.1em;
}
input.gobutton:hover, input.gobutton:focus{
background-color :#825A03;
-webkit-box-shadow: 0 0 1px rgba(0,0,0, .75);
-moz-box-shadow: 0 0 1px rgba(0,0,0, .75);
box-shadow: 0 0 1px rgba(0,0,0, .75);
}
.page_footer {
float: left;
width: 1600px;
background-color: #0080ff;
color: white;
font-family: arial;
text-align: center;
line-height:100px;
vertical-align: middle;
height:100px;
position:fixed;
bottom:0;
left:0;
list-style-type: none;
}
section a:link {
color: blue;
}
section a:visited {
color: blue;
}
.keybotimg {
padding-left:30%;
}
table {
border-collapse: collapse;
}
section div{
margin-left: 50px;
margin-right: auto;
width: 900px
}
section div p{
text-align: left;
}
section div p h2,h4{
text-align: left;
}
In your question you say your footer is fixed. This means it will stay where it is no matter what. Try setting it to float.
I want to make menu on top, and on hover mouse to hide text and display icon. And to add underline under icon.In my code i successfully change text to image but how to add underline under image and make underline 3px wight and 60px length?
There is my code- HTML:
<div class="menu topMenu">
<ul class="topMenuOptions">
<li><span>111</span></li>
<li><span>222</span></li>
<li><span>333</span></li>
</ul>
CSS:
.topMenu {
text-transform: uppercase;
background-image: url('images/1.png');
position: absolute;
height: 88px;
width: 400px;
background: lightcoral;
margin-left: 332px;
padding-top: 30px;
}
.topMenuOptions {
padding: 0;
margin: 0;
margin-left: 155px;
list-style-type: none;
}
.topMenuOptions li {
cursor: pointer;
padding: 10px;
color: white;
font-size: 14px;
display: inline;
}
.topMenuOptions li:hover:nth-child(1) {
background: url('images/2.png') center center no-repeat;
background-position: 20px 0;
background-size: contain;
color:transparent;
}
.topMenuOptions li:hover:nth-child(2) {
background: url('images/3.png') center center no-repeat;
background-size: contain;
background-position: 20px 0;
color: transparent;
}
.topMenuOptions li:hover:nth-child(3) {
background: url('images/4.png') center center no-repeat;
background-size: contain;
background-position: 20px 0;
color: transparent;
}
Use border-bottom: 3px solid white;, for example:
.topMenuOptions li:hover:nth-child(1) {
background: url('images/2.png') center center no-repeat;
background-position: 20px 0;
background-size: contain;
color:transparent;
border-bottom: 3px solid #fff;
}
As per your requirement, I made a fiddle which you can check.
for the underline, you can keep border-bottom of 3px with border-color initially as transparent. this transparent color is required by default to avoid the jerking of the text when a border is added on hover.
I have modified your code a bit just for your understanding.
.topMenu {
text-transform: uppercase;
background-image: url('images/1.png');
position: absolute;
height: 88px;
width: 400px;
background: lightcoral;
/* margin-left: 332px; */
padding-top: 30px;
}
.topMenuOptions {
padding: 0;
margin: 0;
margin-left: 155px;
list-style-type: none;
}
.topMenuOptions li {
cursor: pointer;
padding: 10px;
color: white;
font-size: 14px;
display: inline;
border-bottom: 3px solid transparent;
}
.topMenuOptions li:hover:nth-child(1) {
background: url('http://php.quicoto.com/wp-content/uploads/2013/06/css3.jpg') center center no-repeat;
background-position: 0px 0;
background-size: contain;
color: transparent;
border-bottom: 3px solid #fff;
}
.topMenuOptions li:hover:nth-child(2) {
background: url('http://php.quicoto.com/wp-content/uploads/2013/06/css3.jpg') center center no-repeat;
background-size: contain;
background-position: 0px 0;
color: transparent;
border-bottom: 3px solid #fff;
}
.topMenuOptions li:hover:nth-child(3) {
background: url('http://php.quicoto.com/wp-content/uploads/2013/06/css3.jpg') center center no-repeat;
background-size: contain;
background-position: 0px 0;
color: transparent;
border-bottom: 3px solid #fff;
}
<div class="menu topMenu">
<ul class="topMenuOptions">
<li><span>111</span></li>
<li><span>222</span></li>
<li><span>333</span></li>
</ul>
JSFIDDLE
`<ul>
<li class="option">
<span id="text">111</span>
<span id="image" class="hide">IMAGE</span>
</li>
<li class="option">
<span id="text">222</span>
<span id="image" class="hide">IMAGE</span>
</li>
</ul>`
.option:hover .option > #image
{
display:block;
border-bottom:1px solid black;
}
.option:hover: .option > #text
{
display:none;
}
.hide
{
display:none;
}
you can do something like this, which is more efficient,
inside the image span you can add a image tag, which will also do the job.
I have a h2 tag that has a background image as an icon. I want to align the text vertically within the h2 tag but it doesn't work. I have tried using the display: table-cell; but that hasn't worked either. The text may also crossover onto two lines.
HTML:
<ul class="FeatureRow">
<li><span><h2 class="SpeechBg">Need some help?</h2><p>Feel free to get in contact with us</p></span></li>
<li><span><h2 class="PinBg">Great locations!</h2></span></li>
<li><span><h2 class="ViewBg">View our apartments</h2></span></li>
</ul>
CSS:
a {
color: #2b6893;
text-decoration: none;
}
.FeatureRow{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
.FeatureRow li{
float: left;
padding: 10px;
margin: 10px;
height: auto;
-webkit-box-shadow: 0px 4px 8px #f5f5f5;
-moz-box-shadow: 0px 4px 8px #f5f5f5;
box-shadow: 0px 4px 8px #f5f5f5;
background-color: #fdfdfd;
background-image: -moz-linear-gradient(top,#fbfbfb,#ffffff);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#fbfbfb),to(#ffffff));
background-image: -webkit-linear-gradient(top,#fbfbfb,#ffffff);
background-image: -o-linear-gradient(top,#fbfbfb,#ffffff);
background-image: linear-gradient(to bottom,#fbfbfb,#ffffff);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbfbfb',endColorstr='#ffffffff',GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled= false);
}
.FeatureRow span{
display: block;
width: 260px;
}
.FeatureRow h2{
background-repeat: no-repeat;
padding-left: 65px;
font-size: 22px;
height: auto;
min-height: 60px;
color: #3F92ED;
}
.SpeechBg{
background-image: url(http://joshblease.co.uk/Apartments/images/icons/speech.png);
}
.PinBg{
background-image: url(http://joshblease.co.uk/Apartments/images/icons/pin.png);
}
.ViewBg{
background-image: url(http://joshblease.co.uk/Apartments/images/icons/view.png);
}
JSFiddle Example: http://jsfiddle.net/YPnTp/
In .SpeechBg, .PinBg, and .ViewBg, add line-height: ##px;, where ## is the height (in px) of the background images.
Change your
.FeatureRow h2 , add line-height
css as follows
.FeatureRow h2{
background-repeat: no-repeat;
padding-left: 65px;
font-size: 22px;
height: auto;
min-height: 60px;
color: #3F92ED;
line-height:2.5em;
}
Hello not sure why but having some problem with a navigation. It seems to be overflowing and if I fix it in one browser it fails in the other. So I am not sure what is wrong with it. Recently the CSS broke and the entire menu is beyond messed up.
any ways heres is the site http://www.otaku-plus.com/triton
EDITED: updated code bit: http://jsfiddle.net/yukimura/hqyY2/embedded/result/
here is the css bit for the menu
#dropfish {
background-attachment: scroll;
background-clip: border-box;
background: #111111 url("images/top-bar-bg.png");
background-origin: padding-box;
background-position: 0% 0%;
background-repeat: repeat-x;
background-size: auto;
color: #000000;
left: 0px;
padding-left: 2px;
padding-right: 2px;
padding-top: 2px;
top: 0px;
width: 100%;
height: 44px;
position: fixed;
z-index: 9999;
box-shadow:0px 1px 2px;
}
#dropfish_menu {
width: 90%;
height: 44px;
margin: 0 auto;
}
#dropfish_menu ul {
width: 90%;
height: 44px;
}
#dropfish_menu ul li {
float: left;
padding: 14px 0px;
margin-top: -1px;
}
#dropfish_menu a {
color: #ffffff;
text-shadow:0 -1px 0 #000000;
padding: 14px 16px;
font-size: 14px;
}
#dropfish_menu a:hover {
margin-top: 0px;
padding: 14px 16px;
/* background-color:#cdcdcd; */
background-repeat: repeat;
background-color: #313131;
background-image: url("images/top-bar-bg.png");
background-position: 50% 75%;
cursor: pointer;
}
.active {
background-color: #313131;
background-image: url("images/top-bar-bg.png");
background-position: 50% 75%;
}
html bit for the menu
<div id="dropfish">
<div id="dropfish_menu">
<ul>
<div style="float:left;margin-left:-128px;">
<li><img src="http://opcdn.otaku-plus.com/themes/plus/images/logo.png" height="34px" style="margin-top: -8px;margin-right: 8px; cursor: pointer;" id="phx_return_logo"/></li>
<li>Web</li>
<li>Anime</li>
<li>Manga</li>
<li>News</li>
<li>Events</li>
<li>More</li>
</div>
<div style="float:right;margin-right:-128px;">
<li>Register</li><li>Sign in</li><li>Preferences</li>
</div>
</ul>
</div>
</div>
can some one tell me what is wrong with my CSS? or HTML
I made a possible solution to your problem. See this
#mainNav is floating left and #login is floating right.
I adjusted your mark up.