Nav buttons with hover effect - css

I want to duplicate the style of buttons on this page http://oakespavers.com/ (left-hand side) with the same hover effect. Every time I try, only the text in the boxes are affected. I want the entire div to change colors on mouseover and keep the code really simple.

This might do it:
HTML:
Home
Our Blog
Contact US
​
CSS:
a {
border-radius: 5px;
font-weight: 600;
text-align: left;
font-family: "Verdana", "Geneva", "sans-serif";
text-transform: none;
letter-spacing: 0px;
font-weight: bold;
font-size: 12px;
display: block;
padding: 10px 20px;
color: #666;
background-color: #E1E1E1;
text-decoration: none;
width: 225px;
margin: 5px;
}
a:hover {
color: white;
background-color: #75D039;
}
Here's a fiddle with an example
​

Related

How to customise the dropdown archive widget in Blogger?

I would like some help with customising the archive widget. I've tried the search engines looking for any tutorials but to no avail.
On my tester blog I have installed the default dropdown archive widget. I absolutely dislike the appearance and I'm attempting to alter various elements of it, such as the font, letter-spacing, colours, borders etc however I'm getting nowhere.
There are countless tutorials on how to customise the hierarchy and flat archive widget but nothing for the dropdown menu option. I was told previously that the same coding could be applied to either of the archive widget options but I've found this doesn't work.
The code I'm using to customise the widget is stated below. I've simply added this coding between the tags:
#BlogArchive1 ul li {
text-transform: uppercase;
text-align: center;
font-size: 16px;
letter-spacing: 0.08em;
font-weight: normal !important;
color: #171717;
border: 0;
width: 90%;
outline: none;
text-align: center;
background-color: #fffffff;
}
#BlogArchive1 a {
color: #171717 !important;
font-weight: normal !important;
}
The appearance I'm trying to create is very simple with no border and a clear, white background.
It is very simple, really. You just need to use the below code in order to customize further:
#BlogArchive1 ul {
margin: 0;
padding: 0;
list-style: none;
}
#BlogArchive1 ul li {
float: left;
}
#BlogArchive1 ul li a {
text-transform: uppercase;
text-align: center;
font-size: 16px;
letter-spacing: 0.08em;
font-weight: normal !important;
color: #171717;
border: 0;
width: 90%;
outline: none;
display: block;
padding: 8px 15px;
text-align: center;
text-decoration: none;
background-color: #fffffff;
}
#BlogArchive1 ul li a {
color: #171717
}
#BlogArchive1 ul li a:focus {
color: #333;
}

Strange hover behaviour on link on Chrome

I'm experiencing a strange hover behavior on a link inside a list in Chrome.
I've managed to replicate the issue in this jsFiddle copying the whole html and css from the website.
The problem is on the first element of the side menu, which is the link with "Maria Montessori" in it. What happens is that the hover area is like interrupted in the middle, where the text is. It's like there is something covering the middle part of the button. Try it yourself to understand what I mean.
The relative code is this:
<ul class="page-menu">
<li class="page_item page-item-30">Maria Montessori</li>
<li class="page_item page-item-32">La pedagogia scientifica</li>
...
And the css:
.page-menu {
display: inline-block;
margin-right: 25px;
text-align: center;
width: 210px;
li {
margin-bottom: 10px;
}
li.current_page_item {
a {
background-color: $blue-montessori;
border-bottom: 2px solid $blue-montessori;
color: white;
font-weight: bold;
}
}
li.current_page_parent {
a {
background-color: $blue-montessori;
border-bottom: 2px solid $blue-montessori;
color: white;
font-weight: bold;
}
}
a {
background-color: $grey-light;
border-bottom: 2px solid $grey-light;
color: $grey-dark;
display: block;
font-family: Lato;
font-weight: 300;
line-height: 1.2;
padding: 15px 20px;
text-decoration: none;
text-transform: uppercase;
&:hover {
background-color: $blue-light;
border-bottom: 2px solid $blue-dark;
color: white;
font-weight: 400;
}
}
ul.children {
margin-top: 10px;
li {
margin-bottom: 10px;
margin-left: 10px;
}
li a {
background-color: #f9f9f9;
border-bottom: 2px solid #f9f9f9;
color: $grey-dark;
display: block;
font-family: Lato;
font-size: 12px;
font-weight: 400;
line-height: 1.2;
padding: 10px 20px;
text-decoration: none;
text-transform: uppercase;
&:hover {
background-color: $blue-light;
border-bottom: 2px solid $blue-dark;
color: white;
font-weight: 400;
}
}
li.current_page_item {
a {
background-color: $blue-montessori;
border-bottom: 2px solid $blue-montessori;
color: white;
font-weight: bold;
}
}
}
.page_item_has_children > .children {display: none;} /*hides the submenu*/
.page_item_has_children.current_page_item > .children,
.page_item_has_children.current_page_ancestor > .children {display: block;} /*shows the submenu for the current page or when on its subpages */
}
Inspecting it with developer tools didn't really help and what's strange is that the issue appears to be only on the first element. And in Firefox works fine, anyway.
Your div menu-menu-1-container is overlapping to your first menu because of line height property of your div .nav-menu use padding instead
.nav-menu {
padding: 17px; /* remove line-height property */
}
Updated working Code

Apply CSS to ASP.Net webpage which includes the default master page

In have created a new simple ASP.Net Web Application, in the Default.aspx file added new div as below
<div id="TestDiv"> Hi, This is CSS test. </div>
And for styling the above div, added below css in Site.css file
#TestDiv{ color:Red; }
If I check the Default.aspx page in Design view, found that the above text color is changed to Red.
But when I ran this application and check in browser, found that color is not changed and css is not applied to it.
I want to use the same Site.css which is declared in master page to be applied for the above div and I don't want to declare css style explicitly in Default.aspx page.
Could you please help me out how can I make it work.
Sharing Site.css content on request
/* DEFAULTS
----------------------------------------------------------*/
body
{
background: #b6b7bc;
font-size: .80em;
font-family: "Helvetica Neue" , "Lucida Grande" , "Segoe UI" , Arial, Helvetica, Verdana, sans-serif;
margin: 0px;
padding: 0px;
color: #696969;
}
a:link, a:visited
{
color: #034af3;
}
a:hover
{
color: #1d60ff;
text-decoration: none;
}
a:active
{
color: #034af3;
}
p
{
margin-bottom: 10px;
line-height: 1.6em;
}
/* HEADINGS
----------------------------------------------------------*/
h1, h2, h3, h4, h5, h6
{
font-size: 1.5em;
color: #666666;
font-variant: small-caps;
text-transform: none;
font-weight: 200;
margin-bottom: 0px;
}
h1
{
font-size: 1.6em;
padding-bottom: 0px;
margin-bottom: 0px;
}
h2
{
font-size: 1.5em;
font-weight: 600;
}
h3
{
font-size: 1.2em;
}
h4
{
font-size: 1.1em;
}
h5, h6
{
font-size: 1em;
}
/* this rule styles <h1> and <h2> tags that are the
first child of the left and right table columns */
.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2
{
margin-top: 0px;
}
/* PRIMARY LAYOUT ELEMENTS
----------------------------------------------------------*/
.page
{
width: 960px;
background-color: #fff;
margin: 20px auto 0px auto;
border: 1px solid #496077;
}
.header
{
position: relative;
margin: 0px;
padding: 0px;
background: #4b6c9e;
width: 100%;
}
.header h1
{
font-weight: 700;
margin: 0px;
padding: 0px 0px 0px 20px;
color: #f9f9f9;
border: none;
line-height: 2em;
font-size: 2em;
}
.main
{
padding: 0px 12px;
margin: 12px 8px 8px 8px;
min-height: 420px;
}
.leftCol
{
padding: 6px 0px;
margin: 12px 8px 8px 8px;
width: 200px;
min-height: 200px;
}
.footer
{
color: #4e5766;
padding: 8px 0px 0px 0px;
margin: 0px auto;
text-align: center;
line-height: normal;
}
/* TAB MENU
----------------------------------------------------------*/
div.hideSkiplink
{
background-color: #3a4f63;
width: 100%;
}
div.menu
{
padding: 4px 0px 4px 8px;
}
div.menu ul
{
list-style: none;
margin: 0px;
padding: 0px;
width: auto;
}
div.menu ul li a, div.menu ul li a:visited
{
background-color: #465c71;
border: 1px #4e667d solid;
color: #dde4ec;
display: block;
line-height: 1.35em;
padding: 4px 20px;
text-decoration: none;
white-space: nowrap;
}
div.menu ul li a:hover
{
background-color: #bfcbd6;
color: #465c71;
text-decoration: none;
}
div.menu ul li a:active
{
background-color: #465c71;
color: #cfdbe6;
text-decoration: none;
}
/* FORM ELEMENTS
----------------------------------------------------------*/
fieldset
{
margin: 1em 0px;
padding: 1em;
border: 1px solid #ccc;
}
fieldset p
{
margin: 2px 12px 10px 10px;
}
fieldset.login label, fieldset.register label, fieldset.changePassword label
{
display: block;
}
fieldset label.inline
{
display: inline;
}
legend
{
font-size: 1.1em;
font-weight: 600;
padding: 2px 4px 8px 4px;
}
input.textEntry
{
width: 320px;
border: 1px solid #ccc;
}
input.passwordEntry
{
width: 320px;
border: 1px solid #ccc;
}
div.accountInfo
{
width: 42%;
}
/* MISC
----------------------------------------------------------*/
.clear
{
clear: both;
}
.title
{
display: block;
float: left;
text-align: left;
width: auto;
}
.loginDisplay
{
font-size: 1.1em;
display: block;
text-align: right;
padding: 10px;
color: White;
}
.loginDisplay a:link
{
color: white;
}
.loginDisplay a:visited
{
color: white;
}
.loginDisplay a:hover
{
color: white;
}
.failureNotification
{
font-size: 1.2em;
color: Red;
}
.bold
{
font-weight: bold;
}
.submitButton
{
text-align: right;
padding-right: 10px;
}
#TestDiv
{
color:Red;
}
One of the reason of it not working is Directory Structure , which is making the CSS not reachable from your Default.aspx . otherwise there is no reason why it will not WORK. You can use the IE developer tool by pressing F12 and select the div and see if your site.css is applied or not. You also see the view source and copy the CSS path in the browser to see if it renders or not or your are getting 404
Make sure you made a tag that containing your currect css file location, and your link tag have to be on header but the div part has to be on body.
There are several reasons for this issue. It's always best to use a browser's dev tools to see what is actually being affected by your front-end changes. Chrome offers the absolute best suite for debugging...just right-click on your page and select "Inspect Element" on your div.
As for the specifics of this problem:
Check to see you have referenced Site.css specifically.
Ensure there are no other parent css definitions overriding yours
If there is a conflict (eg: a "div" definition for color), make sure your css ID definition comes AFTER it in the page flow
Alternative options:
Define CSS on a per-page basis using script closures.
Use inline styling for the particular element.
Response To Comments
Well, every browser has default rules that are assigned to the majority of elements. If you find a style that has been inherited from the body, it's likely due to a css "reset" stylesheet and/or schema where body has been given more reasonable default values. I doubt you'll even find that in an ASP.NET application.
I would suggest creating your own stylesheet and referencing it in your default.aspx page. It doesn't actually matter (so long as you reference YOUR stylesheet AFTER the GENERATED stylesheet) but it keeps everything separate. You don't have a need to change the generated CSS for the most part.
Got 2 answers for you:
Tell me where your deafult.aspx file is located? inside a follder something like site/asp/deafult.aspx and your style is in site/style/site.css, if it does then add in link tag <link href="../Style/Site.css" rel="stylesheet" type="text/css" />
If your website is in Site/deafult.aspx and css is in Site/Styles/Site.css then make sure the different bettwen the big and small words are same.

I'm trying to create an active state for a div

I'm trying to create an active state for a div.
Got the hover working but when i'm on the page in question the active won't show.
What i'm trying to implement is the same style as the hover.
Here's the css for the div.
#fp-design a { width: 240px; height: 47px; float: left; display: block; background:url(images/assets/break.jpg) no-repeat; background-position: top right; }
#fp-design a:hover { height: 44px; border-bottom: 3px solid #d3028e; text-decoration:none; }
#fp-design a:active { height: 44px; border-bottom: 3px solid #d3028e; text-decoration:none; }
#fp-design h2 { height: 20px; font-size: 16px; font-weight: bold; margin: 0; padding: 4px 0 0 12px; text-align: left; color: #FFF; text-decoration:none; }
#fp-design h3 { height: 11px; font-size: 10px; font-weight: bold; margin: 0; padding: 0 0 0 12px; text-align: left; color: #FFF; text-decoration:none; }
Here's the page code
<div id="fp-design">
<a href="<?php bloginfo('url'); ?>/web-design/"><h2>WEB DESIGN</h2>
<h3>PROFESSIONAL WEBSITE DESIGN</h3></a>
</div>
TIA
a:active means "is being clicked". Not "is loaded". is that what you are after?
It somewhat reads as if you want the div to change appearance if a page is being viewed. in order to do that you'll need to add a class to the div, the hover/active states won't do it. a:link = link sitting on a page, a:visited = a link that has been clicked previously, a:hover = a link when the mouse is over it, a:active = a link when the mouse clicks on it.

CSS How to properly replace links by button background

I'm trying to replace the links on my app with a button background. However the link text won't center horizontally neither vertically. I'm using the property "background-position: center center;" which I assume would solve my problem.
My HTML:
<a class="violetButtonLarge" href="#">My Link</a>
CSS:
.violetButtonLarge {
display: block;
width: 304px;
height: 41px;
background: url(../images/violetButton_large.png) no-repeat center center;
border:none;
color: #FFFFFF;
font-weight: bold;
font-family: Arial;
background-color: transparent;
text-decoration: none;
}
My image:
What I'm I doing wrong here? This is what I get:
Thanks in advance!
Use text-align:center and line-height:41px to align the text in the vertical and horizontal center.
.violetButtonLarge {
display: block;
width: 304px;
height: 41px;
background: url(http://i.stack.imgur.com/S8zvb.png) no-repeat center center;
border:none;
color: #FFFFFF;
font-weight: bold;
font-family: Arial;
background-color: transparent;
text-decoration: none;
text-align:center;
line-height:41px;
}
Example: http://tinkerbin.com/q5VZR1At
a.button {
background: transparent url('violetButton_large.png') no-repeat scroll top right;
color: #FFFFFF;
display: block;
float: left;
font: normal 12px arial, sans-serif;
height: 24px;
margin-right: 6px;
padding-right: 18px;
text-decoration: none;
}
<a class="button" href="#" onclick="this.blur();"> … </a>
Probably you should set the padding, then you don't need to set the width and height. The vertical-align: baseline helps to set them on the same line with "real" input buttons.
.button {
padding: .4em 1.6em .44em 1.6em;
vertical-align: baseline;
text-align: center;
text-decoration: none;
cursor: pointer;
}
Edit: Sorry i didn't saw the image in your code, maybe you should get a glimpse at this great example: CSS Gradient Buttons.

Resources