How to do this vertical navigation bar? - html

i am trying to do a vertical navigation bar from this codepen
http://codepen.io/bronsrobin/pen/GAlfg
but i only need the navigation bar nothing else
i tried to copy the html related to the navigation bar but nothing happened
you can check my fiddle
http://jsfiddle.net/922ug/
html
<aside>
<a class="current">Home</a>
<a>Users</a>
<a>Schedule</a>
<a>Info</a>
</aside>
look on the js fiddle to understand.
can anybody fix it for me please and tell me whats the problem?

There are two issues with your JSFiddle code.
1: Your are using SCSS where normal CSS is expected
All your CSS lines affecting color are actually written in SCSS code.
SCSS (Sassy CSS) is a CSS preprocessor language, it enables you write CSS with a few extra features that are not normally not allowed (such as the use of variables and calculations); when you save it, a program converts/compiles it into a standard CSS file.
But rarely should you enter straight SCSS into a browser. In this case, it must be converted to regular CSS first (note that the CodePen example specifically says "CSS (SCSS)" at the top, so CodePen is automatically doing this compiling; JSFiddle is not).
For example, this SCSS line in your JSFiddle:
background-color: $black;
It uses a variable, $black. CSS will not understand this. Using the CodePen example's color variables at the top, the CSS line would normally be compiled to:
background-color: #171616;
Which is perfectly valid normal CSS.
Here's the fully-compiled CSS you need:
aside {
width: 17%;
min-width: 150px;
max-width: 300px;
height: 100%;
background-color: #171616;
position: fixed;
top: 50px;
float: left;
padding: 25px 0 0 0;
}
aside a {
display: block;
line-height: 40px;
border-right: 4px solid transparent;
cursor: pointer;
transition: background-color .3s linear,
border-right-color .3s linear,
color .3s linear;
color: #808080;
padding: 0 0 0 30px;
font-weight: 600;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 1px;
}
aside a:hover,
aside a.current {
background-color: #1D1B1B;
border-right-color: #FDCC1C;
color: #FFFFFF;
}
2: You are using a jQuery script but did not add the jQuery library to your code
This keeps the code from successfully running. In JSFiddle, you can add the library by using the drop-down menus on the far-left.
The revised menu solving both issues can be seen here:
http://jsfiddle.net/922ug/1/

Related

Removing underline on links on wordpress site. text-decoration: none; doesn't work

Before you mark me as duplicate: I've read all the similar questions and tried the solutions and either I'm too dumb to understand them (a valid possibility), or my problem is different, but they didn't work for me.
I was marked off-topic on wordpress forum since it is apparently a css/html problem, so I reposted here.
Now on to the problem:
I'm having trouble with removing the underlines of some links I have on my site. Here's my html definition of the links:
<p style="text-align: center;">
<a class="buttonL" href="http://cns.uni.lu/homel"><</a>
<a class="buttonR" href="http://cns.uni.lu/homer">></a>
</p>
And my CSS from the "custom CSS" page:
.buttonL {
border-radius: 50%;
position:fixed;
top: 50%;
left: 0%;
background-color: transparent;
border: none;
color: grey;
padding: 5px 20px;
text-align: center;
text-decoration: none !important;
display: inline-block;
font-size: 50px;
margin: 4px 2px;
cursor: pointer;
font-weight: 900;
}
.buttonR {
border-radius: 50%;
position:fixed;
top: 50%;
right: 0%;
background-color: transparent;
border: none;
color: grey;
padding: 5px 20px;
text-align: center;
text-decoration: none !important;
display: inline-block;
font-size: 50px;
margin: 4px 2px;
cursor: pointer;
font-weight: 900
}
I know it's redundant and inelegant. No use commenting on that. I can make it more elegant later.
For some reason, there is a line underneath the links, that won't go away. I've tried using
text-decoration:none !important;
, but to no avail. I've applied it on .buttonL, .buttonR, a, .buttonL a, .buttonR a, .buttonL:link, .buttonL:active, .buttonR:link, .buttonR:active, .buttonL a:link, .buttonL a:active, .buttonR a:link, .buttonR a:active.
I've also tried doing
border-bottom: none;
and
box-shadow: none;
, also to no avail.
Any ideas as to what I'm doing wrong?
P.S. I can't link the page I'm referencing, as it is on an internal network. Sorry...
Here's a screenshot of the page:
The links in question are the arrows to either sides. Although the other links have the same problem.
Use This CSS may be help you thanks
body .buttonL, body .buttonR {
text-decoration: none !important;
}
OR USE THIS
body a{
text-decoration: none !important;
}
I just found the solution:
For some reason the background gradient (although it was white) left a line at the backgrounds border (or center - I'm not sure). To remove this, I added
.entry-content a{background-image:none;}
to the css file, instead of just making it transparent.
Thanks for all the help :D
If the css is not working means then use jquery
<script>
$(document).ready(function(){
$('.buttonL').css('text-decoration','none');
$('.buttonR').css('text-decoration','none');
});
<script>
I hope this will solve your issue.

CSS - Background image doesn't show, background color works fine

My problem is as follows: I replaced some items (navigation, footer) in my HTML-code by adding objects instead and loading them externally. Since I did that, I can't load background pictures into my 'collage' part of the website.
HTML: Stripped it off of everything not part of the problem (except for the content).
The container is just a wrapper for the whole thing. My website will contain a bunch of images in the middle that link to the appropriate websites and, on hover over, display a short description and a title.
.collage is used to style the overall frame of the element
id will be used to add the background images (worked before!)
HTML-Part:
<!DOCTYPE HTML>
<head>
<link rel="stylesheet" type="text/css" href="styles/main.css">
<title>Startseite</title>
</head>
<html>
<body>
<div id="container">
<article>
<div class="collage" id="cg">
<a href="#">
<div class="text">
<h2>CG-Projekte</h2>
<p>
Computergerenderte Projekte, basierend auf der Open-Source-Software 'Blender', sowie Tutorials für einige der Projekte.
</p>
</div>
</a>
</div>
</article>
</div>
</body>
</html>
Use the first part for general purposes.
body: font-size so I can scale all em elements with one value (mobile)
#container: Placed in the middle, positioned accordingly, slightly darker than the overall background. Pretty basic
article .collage: Display as table to make the image hover-over work properly (which it does even now)
#cg: The part that isn't working. I can change the background-color with this tag, but not the image
.text parts: Those are the designs for the hover-over part, they work as far as I can see. I am using opacity to make it invisible, until it is hovered over.
CSS-Styling:
*{
margin: 0;
padding: 0;
}
body{
font-size: 100%;
background-color:#2B2B2B;
}
#container{
margin: 0 auto;
margin-top: 100px;
min-height: 50em;
min-width: 70em;
max-width: 80em;
background-color: #2A2A2A;
border: 2px solid white;
}
article .collage {
display: table;
height: 500px;
width: 700px;
margin: 100px 0 0 5px;
border: 1px white solid;
}
#cg{
background: url("cg_collage.jpg");
}
article div .text{
height: 400px;
width: 800px;
background: rgba(0,0,0,0.55);
position: relative;
top: 0;
left: 0;
vertical-align: middle;
display: table-cell;
opacity: 0;
transition: all ease-in 0.1s;
}
article .collage a{
text-decoration: none;
}
article .collage .text{
padding: 0 10px 0 10px;
}
article .collage .text h2{
text-align: right;
text-decoration: none;
color: #ADFF5C;
line-height: 70px;
font-size: 40px;
font-family: monospace;
border-bottom: 3px ridge #FFFFFF;
line-height: 50px;
}
article .collage .text p{
text-align: right;
font-family: Arial, Helvetica, sans-serif;
margin-top: 5px;
color: #ADFF5C;
}
article div:hover .text{
opacity: 1;
}
Folders
As I said: I can change the background color fine, hover-over works perfectly. The only thing that won't work is the background-images. Images work fine if I embed them in the html-file.
I can't figure it out and a different viewpoint might find the 'Error 30' ;)
All of the other answers are correct, in the sense that your paths are not correct. The reason why this is happening is b/c your CSS file is in, I'm assuming, the "styles" folder, and when you reference your image, the path is assuming that the image is in the same folder as your CSS file.
Instead of using ".." to "back out" of a folder, it's always a best practice to use relative paths. Reason being, if you move files, folders, etc, then the path will always be correct.
Hence, instead of using background: url('../cg_collage.jpg'), you should use background: url('/cg_collage.jpg'). The "/" at the beginning tells the file(s) to look at the root and start from there. So rather than always counting how many folder structures you need to "drop back", use relative paths.
Also, a good practice is to always have your images in a folder, and name that folder appropriately (eg - "img" or "images" or w/e).
Helpful article on absolute and relative paths.
You have to change your CSS:
#cg{
background: url("cg_collage.jpg");
}
To:
#cg{
background: url("../cg_collage.jpg");
}
This is because your image is outside styles folder (where your stylesheet is).
I am not sure but CSS is looking for image file in its direcotry (styles). Try this one:
#cg{
background: url("../cg_collage.jpg");
}
You code works perfectly, when the file cg_collage.jpg is in folder /styles. Is it there in your project?

How to make Twitter-Bootstrap like buttons

I basically want to create a button like the big "Download Bootstrap" button on this side: http://getbootstrap.com/
Note: I want to create the button myself just with css & html and not with the twitter-bootstrap framework
I was able to do it pretty well but then I noticed that there was a bug: http://jsfiddle.net/vk5DV/
If you zoom in while hovering over the button you will notice that in the corner of the button there is something wrong. I think the link itself gets styled with the white background but I have no idea why.
#googlink a {
color: white;
transition: all 0.2s linear 0s;
}
#googlink :hover {
background-color: white !important;
color: #99CC00;
}
why does the link get a white background too (and not only the button div)?
If a border-radius is added it seems ok
eg
#googlink :hover {
background-color: white !important;
border-radius: 6px;
color: #99CC00;
}
http://jsfiddle.net/f3kzb/show/
Although if you simplify it a bit, i think it works fine with the code you already have. Also specified as a class to be used with any link.
http://jsfiddle.net/fe25t/
html
<div id="green">
Google
</div>
css
body {
margin: 0;
padding: 0;
}
#green {
background-color: #99CC00;
}
a {
text-decoration: none;
color: black;
}
.special-link {
border-radius: 10px;
margin: 40px;
display: inline-flex;
height: auto;
width: auto;
font-size: 65px;
background-color: #99CC00;
border: 2px solid white;
color: white;
transition: all 0.2s linear 0s;
}
.special-link:hover {
background-color: white !important;
color: #99CC00;
}
Do not use a div, just style the link (a).
Currently you are styling both the link and the div, which is not necessary - this creates conflicts and, semantically, is useless.
You would want to use a div only if you needed to nest multiple elements within it and then position the div to position all the elements at once (just an example).
There you go.. check this out.. The hover border has to be round so that it does not overlap the normal border. This addition is under the hood of the main button border so it does not pop out at the corners.
#googlink :hover {
border-radius: 6px;
background-color: white !important;
color: #99CC00;
}
http://jsfiddle.net/47vDq/

HTML/CSS: Mysterious Blank Space

Currently I have been encountering a problem with my website where there is a mysterious blank space at the top of my website that is not attributed to any specific div or HTML item. This is happening on all my pages and my usual guides are as dumbstruck as I to this problem.
Alas, I cannot give code snippets of the issue because I don't know where the problem is being made however I do have a live version of the website available.
Live version of issue: sch242.comeze.com
If anyone can figure out the reason for this I would be very appreciative. I cannot find another topic similar to this on stackoverflow already.
Remove margin-bottom from <nav id="menu"> CSS
nav {
background: none repeat scroll 0% 0% rgb(255, 255, 255);
color: rgb(51, 51, 51);
margin-bottom: 6em; //Remove this property
}
In your main.css the following class giving this issue.
nav {
background: #FFFFFF;
color: #333333;
margin-bottom: 6em; /* Issue line*/
}
your nav style has a margin-bottom. If you remove it will stick to the top.
nav {
background: #FFFFFF;
color: #333333;
/*margin-bottom: 6em;*/
}
main.css file
nav {
background: #FFFFFF;
color: #333333;
margin-bottom: 2em; /* this will make it look better */
}

How to create the dropdown arrow from Twitter's Bootstrap?

I've been checking/using Twitter Bootstrap for quite a while now. I like what they've done, but more than that, I like understanding what I do.
After inspecting the dropdown arrow with Chrome's inspector, it seems it is in fact a ↓ html entity. I've been trying to reproduce this but with no success. I'm getting an ugly arrow and not the simple triangle.
What are the minimum CSS properties to use in order to reproduce it?
PS: A link to a jsFiddle trying to reproduce it.
Here's a working example.
You don't need the extra ↓ in your HTML and the border-color was white, making it invisible on a white background to your very human eyes.
First avoid default browser styles. Then use your own. As an example:
select{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
height: 60px;
border: 1px solid #ccc;
padding: 0 0 0 20px;
font-size: 18px;
font-weight: 300;
border-radius: 0;
color: #999;
letter-spacing: 1px;
background: url("../img/arrow#2x.png") calc(100% - 10px) 24px #fff no-repeat;
cursor: pointer;
}