Check out the JSfiddle showing what I am up to: http://jsfiddle.net/Amp3rsand/FPj3s/1/
HTML:
<ul id="navigation">
<li>BLAH</li>
<li>MORE <br /> BLAH</li>
<li>STILL <br /> MORE</li>
<li>YADDA <br /> YADDA</li>
<li>ETC ETC <br /> ETC ETC</li>
<li>FINISH</li>
</ul>
CSS:
body {
font-size: 12px;}
}
#navigation {
width: 600px;
height: 50px;
position: absolute;
left: 20px;
top: 25px;
}
#navigation li {
list-style-type:none;
width: 94px;
height: 40px;
display: block;
float: left;
margin: 0 5px 0 0;
text-align: center;
font-weight: bold;
background: lightgrey;
}
#navigation li:first-child {
border-top: 40px solid lightgrey;
border-left: 25px solid transparent;
height: 0;
width: 70px;
background: none;
}
#navigation li:first-child a {
position: relative;
top: -35px;
right: 0px
}
#navigation li:last-child {
border-top: 40px solid lightgrey;
border-right: 25px solid transparent;
height: 0;
width: 70px;
background: none;
}
#navigation li:last-child a {
position: relative;
top: -35px;
left: 5px;
}
#navigation li:last-child a:hover {
top: -35px;
left: 5px;
}
#navigation li a {
display: block;
height: 40px;
text-decoration: none;
color:#000;
}
#navigation li a:hover {
background: grey;
}
The lightgrey shapes are what I would like the hover to look like. Only the first and last children need to look different but I am unsure of how to go about messing with the borders on hover without ruining the layout. I have had to move the first and last 'a' elements because of the border shenanigans and now I'm stuck.
What would you suggest?
EDIT:
I just realised I could do this to change the shape of the hover bit but the link position is still causing trouble
#navigation li:last-child a:hover {
border-top: 40px solid grey;
border-right: 25px solid transparent;
height: 0;
width: 70px;
background: none;
}
See it live here on JS Fiddle
The properties you want to change are of the <li> elements so target the list items hover state and change the background and border color
#navigation li:hover {
background: grey;
}
#navigation li:first-child:hover,
#navigation li:last-child:hover{
background: none;
border-top-color: grey;
}
Updated fiddle
Essentially, you want to set the 'border-top' to grey for the first/ last child.
You could use in CSS:
#navigation li:first-child:hover {
border-top: 40px solid lightgrey;
}
But this didn't work in Google Chrome, for me, so perhaps just apply that as a hover effect using jQuery?
Related
The styling I look into achieving can be shown in this screenshot:.
Please tell how to create the effect that i pointed out using CSS.
a{
text-decoration:none;
}
a:hover {
text-decoration:underline;
}
This should work for links, however the effect in the picture seems to be made with the link's container border:
div.yourcontainer:hover{
border-bottom:2px solid red;
}
This should work ^^
By using :hover and setting a border-bottom. Something like this
ul{
list-style: none;
padding: 0;
margin: 0;
}
ul li{
float: left;
margin: 0 5px;
}
ul li a{
text-decoration:none;
color: black;
}
ul li:hover{
border-bottom: 2px solid red;
}
<ul>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
a {
display: inline-block;
position: relative;
text-decoration: none;
text-align: center;
}
a:hover:before {
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
bottom: 0;
box-shadow: inset 0 -10px 0 #11c0e5;
}
a span {
display: block;
width: 100px;
height: 40px;
background-color: red;
padding-top: 20px;
}
<a href="#">
<span>link texts</span>
</a>
I am trying to make a dropdown-menu. So for this purpose, I've created a div and some anchor links inside, but the display: block; is not working. The cursor is default & the anchor does not seem to be a link.
Here is my HTML:
<div id="custom-wrapper">
<ul>
<li>View full profile</li>
<li>Logout</li>
</ul>
</div>
The CSS:
div#custom-wrapper
{
width: 200px;
height: auto;
position: fixed;
right: 15px;
top: 38px;
border-radius: 6px;
background: #fff;
border: 1px solid lightgrey;
}
div#custom-wrapper ul
{
list-style-type: none;
}
div#custom-wrapper ul li
{
width: 100%;
height: 50px;
line-height: 50px;
text-align: center;
}
div#custom-wrapper ul li a
{
text-decoration: none;
display: block;
color: grey;
font-family: sans-serif;
border-bottom: 1px solid lightgrey;
}
What's wrong with my code?
Display block element works perfect, Just you need to remove padding and margin for ul element.
/*** Default CSS Attributes ***/
#custom-wrapper ul {
margin: 0;
padding: 0;
}
/*** Overwrite CSS Attributes ***/
#custom-wrapper ul {
margin: 0 !important;
padding: 0 !important;
}
div#custom-wrapper {
width: 200px;
height: auto;
position: fixed;
right: 15px;
top: 38px;
border-radius: 6px;
background: #fff;
border: 1px solid lightgrey;
}
div#custom-wrapper ul {
list-style-type: none;
margin: 0;
padding: 0;
}
div#custom-wrapper ul li {
width: 100%;
height: 50px;
line-height: 50px;
text-align: center;
}
div#custom-wrapper ul li a {
text-decoration: none;
display: block;
color: grey;
font-family: sans-serif;
border-bottom: 1px solid lightgrey;
}
<div id="custom-wrapper">
<ul>
<li>View full profile</li>
<li>Logout</li>
</ul>
</div>
There is a padding for ul. Remove it:
div#custom-wrapper ul
{
list-style-type: none;
padding:0;
}
That is not the right way to build a dropdown. Check this (you would need to include Bootstrap library though, which by the way may make your life much easier).
need help with css codes for a border above and below the header like this website : http://www.simpsonmagazine.cc/ . I also want to change the slider height for my site : http://www.etctaylors.com/
CSS codes used so far :
/*
Theme Name: Sight Child
Theme URI: http://example.com/twenty-fourteen-child/
Description: Twenty Fourteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: Sight
Version: 1.0.0
Tags: light, dark, two-columns, right-sidebar, responsive-layout,
accessibility-ready
Text Domain: sight-child
*/
/* =Theme customization starts here
-------------------------------------------------------------- */
.main-navigation {
border-bottom: solid;
border-color: black;
border-width: 3px;
}
.main-navigation li {
text-indent: 5px;
}
.main-navigation ul {
margin-left: auto;
margin-right: auto;
width: 100%;
}
.main-navigation li {
border: none;
}
.main-navigation {
margin-left: 0;
margin-right: 0;
width: 100%;
}
.main-navigation li:hover > a, .main-navigation ul ul :hover > a,
.main-navigation ul ul a:hover {
color: black !important;
text-decoration: none;
}
.main-navigation ul ul, .main-navigation ul li:hover {
background: none;
}
.main-navigation ul ul {
background: none;
}
.main-navigation ul ul a {
color: grey;
}
Try this it will work, I tried it on firebug
.site-header{
border-bottom: 1px solid #000;
border-top: 1px solid #000000;
height: 240px;
padding: 3px 0 3px 0;
position: relative;
}
.site-header:before {
content: '';
border-top: 5px solid #000;
width:100%;
position: absolute;
left:0;
top: 1px;
}
.site-header:after {
content: '';
border-top: 5px solid #000;
position:absolute;
width:100%;
left:0;
bottom:1px;
}
To add a border to your navigation, you can use the following css line:
border-top: 3px solid black;
what do you mean with slider height change?
Here is a Jsfiddle i made
use this for border like the mentioned site to your header css
markup
<div id="top">
<div id="hwrap">
</div>
</div>
you should include your header contents inside hwrap div
css
#top {
width: 940px;
float: left;
border-bottom: 5px solid #222;
border-top: 5px solid #222;
padding-top: 1px;
margin-bottom: 20px;
padding-bottom: 1px;
}
#hwrap {
width: 940px;
float: left;
border-bottom: 1px solid #222;
border-top: 1px solid #222;
padding-top: 20px;
margin-bottom: 0px;
padding-bottom: 20px;
}
DEMO
for changing the slider height in your site
.featured-post {
background: #ffea97;
height:600px; // or your prefered vaklue
}
I'm trying to create menus for a webpage using HTML and CSS. When the menus are displayed those nasty bullets appear. I don't want them. How do I get rid of them?
Also, the submenus need to allow for variable length strings. I had to specify a width: 80px; property for the .dropdown li element. If I didn't, all the menus got squished together.
For the submenus, if I have a lengthy li like this:
<li>Most Popular Artists</li>
All that gets displayed is the word "Most".
So I need two things solved: Get rid of the bullets, and make the submenus handle variable length strings.
HTML:
<nav id="top_menu">
<img src="media/images/logo_large.jpg">
<ul class="dropdown">
<li class="dropdown_trigger">
NEWS
<ul>
<li>Subitem1</li>
<li>Subitem2</li>
<li>Subitem3</li>
<li>Subitem4</li>
</ul>
<li>
<li class="dropdown_trigger">
SOCIAL
<ul>
<li>Subitem1</li>
<li>Subitem2</li>
<li>Subitem3</li>
<li>Subitem4</li>
</ul>
</li>
</ul>
</nav>
CSS:
#top_menu{
position: relative;
top:35px;
left: 90px;
width:660px;
height:55px;
background-color: black;
border:1px solid black;
opacity:0.6;
filter:alpha(opacity=60); /* For IE8 and earlier */
}
.dropdown {
background: black;
border: 1px solid black;
float: right;
padding: 1px 0 0 1px;
margin: 0 0 20px;
line-height: 55px;
}
.dropdown a {
background: black repeat-x;
border: 1px solid black;
border-top-width: 0;
color: white;
display: block;
line-height: 25px;
overflow: hidden;
text-decoration: none;
height: 25px;
}
.dropdown a:hover {
color: #30B3FF;
background: #666;
}
.dropdown ul a {
background: black;
}
.dropdown > li {
list-style: none;
position: relative;
text-align: left;
font: bold 12px Tahoma;
*display: inline-block;
width: 80px;
/* IE7 hack to make inline-block work right */
*zoom: 1;
display: inline;
}
.dropdown li.dropdown_trigger {
display: inline;
float: left;
margin: 0 0 0 -1px;
}
.dropdown ul {
background: black;
border: 1px solid black;
border-top-width: 0;
position: absolute;
top: 26px;
left: -1px;
z-index: 9999;
}
.dropdown ul {
display: none;
}
.dropdown li.dropdown_trigger:hover ul {
display: block;
}
You should add list-style-type: none; to your main ul CSS like so:
.dropdown ul {
list-style-type: none;
background: black;
border: 1px solid black;
border-top-width: 0;
position: absolute;
top: 26px;
left: -1px;
z-index: 9999;
}
.dropdown ul {
display: none;
}
And looking at that you can consolidate those two items & format them for readability as well:
.dropdown ul {
display: none;
list-style-type: none;
background: black;
border: 1px solid black;
border-top-width: 0;
position: absolute;
top: 26px;
left: -1px;
z-index: 9999;
}
And past that you can even add the !important to force an override:
.dropdown ul {
display: none;
list-style-type: none !important;
background: black;
border: 1px solid black;
border-top-width: 0;
position: absolute;
top: 26px;
left: -1px;
z-index: 9999;
}
Add list-style:none; to your unordered (bulleted) list to hide the default bullets. Apply this role to ul in this way you will not have to apply it to each ul.class every time.
ul {
list-style:none;
padding:0;
margin:0;
}
Small question on how to achieve some styling on a HTML / CSS UL menu.
I have a standard UL menu, but having some issues getting my head around how to achieve a certain look to the styling. The UL menu as it currently stands is shown here:
http://jsfiddle.net/WMQqt/
(HTML)
<ul id="nav">
<li>CONTACT US
</li>
<li>HOME
</li>
</ul>
(CSS)
#nav {
list-style: none;
margin-bottom: 10px;
*/ margin-top: -6px;
position: relative;
right: 286px;
z-index: 9;
height: 26px;
padding: 4px 4px 4px 4px;
font-weight: bold;
}
#nav li {
float: right;
margin-right: 10px;
}
#nav a {
display: block;
padding: 5px;
color: #444444;
background: #fff;
text-decoration: none;
border: 1px solid grey;
}
#nav a:hover {
color: #fff;
background: #04B431;
}
I'd like the menu buttons to have a small 1px border, but then some white space padding of around 3px before the background color starts.
Similar to how this looks:
http://jsfiddle.net/6PY7z/
Can this be done using the UL menu method?
Thanks for any advice, I'm no expert with HTML / CSS.
Add margin to a tag and move border to li
#nav li
{
float: right;
margin-right: 10px;
border: 1px solid grey;
}
#nav a
{
display: block;
padding: 5px;
color: #444444;
background: #ccc;
text-decoration: none;
margin:3px;
}
DEMO
you can use the following styles to achieve what you want:
#nav li
{
float: right;
margin-right: 10px;
border: 1px solid grey; /*put original border here*/
}
#nav a
{
display: block;
padding: 5px;
color: #444444;
background: #d8d8d8; /*new background-color*/
text-decoration: none;
border: 3px solid white; /*add white padding here*/
}
http://jsfiddle.net/WMQqt/4/
ok
in html go
<dl><div><dt>F</dt><dd>T</dd></div>
<div><dt>F</dt><dd>T</dd></div>
<div><dt>F</dt><dd>T</dd></div>
<div><dt>F</dt><dd>T</dd></div>
</dl>
in css
dl { display: flex;
flex-direction: column;}
some hints...
dt float left AND
dd float right