Centering a specific DIV - Have Tried a LOT - Failing Constantly - css

Good evening guys,
This is my first time on this website, so I apologize if I do this REALLY badly.
First and foremost I have a website designed for use with wordpress, and the issue I'm having is that I want my horizontal navigation at the top to look a certain way, but if I leave it the way it is right now it seems to DROP down to a second row...which makes me sad.
So I have decided that I will just make the individual buttons smaller, and then CENTER them so that even if the viewer doesn't have the fon't I'm using (which is IMPACT), then it will just adjust how they are centered, as opposed to dropping down.
I have tried to find a way to do this for DAYS and I have failed repeatedly. I use "firebug" with firefox to test the code changes, and I just can't find a way to make this work.
The webpage is http://www.crapcast.com and the code is just the top of the page, below the logo. I will include current CSS, which is formatted the way it is to fulfill the current usage of the page (but again, tends to show a double row on some older browsers and on phone browsers).
#navigation {
float:left;
position:relative;
z-index:9999;
}
#navigation ul {
font-family:Impact,Charcoal,Times New Roman;
font-size:22px;
list-style-image:none;
list-style-position:outside;
list-style-type:none;
}
#navigation li {
float:left;
position:relative;
}
#navigation li a {
float:left;
letter-spacing:2.45px;
padding:15px;
text-decoration:none;
}
#navigation .main_category {
background-position:center top;
background-repeat:no-repeat;
}
#navigation .active {
background-position:0 10px;
background-repeat:no-repeat;
}
#navigation li.current-menu-item, #navigation li.current-menu-ancestor, #navigation li.current-post-parent, #navigation li.current-menu-parent {
background-position:0 10px;
background-repeat:no-repeat;
}
#navigation ul li ul {
display:none;
left:0;
list-style-image:none;
list-style-position:outside;
list-style-type:none;
position:absolute;
top:50px;
width:230px;
}
#navigation ul li ul li a {
padding:15px 0 15px 36px;
width:194px;
}
#navigation li a.odd {
background-position:18px 23px;
background-repeat:no-repeat;
text-transform:uppercase;
}
#navigation li a.even {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#212121 url(../images/navigation_dot.gif) no-repeat scroll 18px 23px;
}
#navigation li a.odd:hover, #navigation li a.even:hover {
background-position:18px 23px;
background-repeat:no-repeat;

I think your problem is related to your fonts:
#navigation ul {
font-family:Impact,Charcoal,Times New Roman;
...
}
...
...
#navigation li a {
...
letter-spacing:2.45px;
...
}
You are using the width of the fonts to set the width of your items in your menu.
So when there is no Impact font in the system, the items increase their width a lot more.
The width of each character of the Impact font is way to narrow compared to the other ones you put there.
If you try with equivalent width fonts I'm sure you will fix your problem.
In the iPhone, and I guess Android, you cannot find the Impact font there.
Try Helvetica, Arial instead of Impact and change your letter-spacing to 2.0px or something like that.

I don't see the 'two row' problem in any browser, even IE6.
And if want to make sure your visitors gets to view the exact font you're using.. may it be Impact or any sort of fancy fonts. Try using http://www.fontsquirrel.com/fontface/generator.
Just upload your desired font, download the kit & follow the uberly simple instructions (^_^)

Related

Chrome wont show drop down unless browser is re sized or new tab is open?

This problem has been rattling my brain for ages. Basically I have a simple drop down that activates off one link on hover state. However when you first load up the site in chrome (with no other tabs active) when you hover over the parent the sub-menu appears then the moment you try to move to select it, it disappears again. I've currently tried all different combinations of Display / Visibility and nothing has worked.
The site in question deadpixelcreative
The stranger part is that if you re-size the browser or open another tab the menu works fine?
I'm at a total loss and any help would be very much appreciated!
Thanks in advance!
.CSS
#cssmenu {
font-family: 'AlternateGothicCom-No2', sans-serif;
line-height: 15px;
text-transform: uppercase;
text-align: center;
position:fixed;
width:100%;
top: 0px;
z-index:100;
}
#cssmenu > ul {
width: 100%;
list-style-type: none;
padding: 0;
margin: 0;
background: #333333;
}
#cssmenu > ul li#responsive-tab {
display: none; }
/* Hide for large screens */
#norm {}
#cssmenu > ul li {
font-size: 20px;
display: inline-block;
*display: inline;
zoom: 1;
color:#fff;
}
#cssmenu > ul li.right {
float: right;
}
#cssmenu > ul li.has-sub {
position: relative;
}
#cssmenu > ul li.has-sub:hover ul {
visibility:visible;
}
#cssmenu > ul li.has-sub ul {
visibility:hidden;
width: 100%;
left:0;
float:left;
position: fixed;
margin: 0;
padding: 0;
list-style-type: none;
background: #D9EE27;
}
#cssmenu > ul li.has-sub ul li {
/*display: inline-block;*/
color:#333;
font-size:16px;
}
#cssmenu > ul li.has-sub ul li > a:hover{
color:#fff;
}
#cssmenu > ul li.has-sub > a {
background-repeat: no-repeat;
background-position: 90% -95%;
}
#cssmenu > ul li.has-sub > a.active,
#cssmenu > ul li.has-sub > a:hover {
background-position: 90% 195%;
color:#333;
}
#cssmenu > ul li a {
display: block;
padding: 12px 24px 11px 24px;
text-decoration: none;
}
#cssmenu > ul li a.active,
#cssmenu > ul li a:hover {
background: #D9EE27;
}
I played around a little bit, it is actually not easy to debug because when I open Chrome developer tool to make changes, problem disappears. I found the following and I hope one them work since I could not actually check it myself.
div#cssmenu has a height of 38px because anchor tags have padding top 12px, padding bottom 11px and line height of 15px. For some reason in some views div#cssmenu's height changes to 37px while anchor tags remain 38px. The top property of fixed positioned 'li.has-sub > ul' is being calculated by the browser which maybe the problem because of an unknown margin or something, try:
li.has-sub ul {top : 37px}
'#wrapper' is not actually wrapping anything since its width is defined by the browser as 0px. Also it is at the top of the page, the only reason it is not covering the top is its '-1' z-index. Try to make it how it is suppose to be.
If adding 'top: 37px' causes problem with your website being responsive try having it in a #media.
The other thing that is worth mentioning is when you have #media for views in mobile devices remember that you no longer have on hover state for touch screen devices for your drop down menu.
Hope it solves the issue!
I saw this issue on a coworker's laptop. I had the same latest version of Chrome on Windows (Version 76.0.3809.100 (Official Build) (64-bit)) and yet I didn't see the issue. I found an obscure reference (on salesforce) about a Chrome issue with cross-origin iframes and cut-off dropdown text (which yes, this dropdown is on a cross-origin iframe on our webpage).
I applied the fix below to laptop and the webpage shows up as it should.
"Windows specific issue - Dropdown lists are rendered based on the DPI
scaling of the main display.
Chromium KI:
Issue 877625: Dropdown input in cross-origin iframes render with the
DPI scaling of the main monitor in Windows
In order to replicate this issue you must have multiple displays, and
your main display must be set to a different DPI scaling level from
your external display. If the DPI on your main display is larger than
the DPI on your external display, the dropdown options will appear cut
off when the list is opened. Alternatively, if your external display
DPI scale is larger then there will be a large blank area in the
dropdown when rendered.
As a workaround, you can set all monitors to the same DPI scale
setting. To do so right click on your Desktop and select Display
settings, then under Scale and Layout make sure the value is the same
for the field Change the size of text, apps, and other items on all
displays."

css whole menu color change on hover

i'm really new to html and css, and i thought having a project while working through tutorials would help me stay motivated while learning a lot.
i've been playing around with this menu, and it's almost there - but now there seems to be this wall and i just don't get how to get over it! i have searched for hours on several sites and am now ready to throw this thing outta the window...
here's a jsfiddle: http://jsfiddle.net/64Grv/
so what i wanted to achieve is that on hover of one submenu the whole menu changes color (instead of the hovered link now). if i hover on "more stuff" for example, all of "menupoint2, stuff, more stuff, even more stuff...." should change color.
how should i go with that? i've tried putting different classes, to no avail - i guess i put them at the wrong place. or is this possible with some kind of box?
i apologize for the messiness of my css (just a beginner messing around..), and i'd really appreciate it if somebody had concrete tips on how to do this :)
thank you very much!
CSS:
#navigation ul
{
margin:0px;
padding:0px;
position:relative;
text-align:center;
}
#navigation ul li
{
display:inline;
float:right;
line-height:20px;
list-style:none;
margin-right:3%;
margin-top:5%;
position:relative;
}
#navigation li a
{
display:block;
font-family: "Helvetica", "Arial", sans-serif;
font-size:1em;
color:#04B4AE;
text-decoration:none;
}
#navigation li a:hover
{
color:#08298A;
text-decoration:none;
}
#navigation li ul
{
font-size:0.8em;
background-color:transparent;
display:block;
margin:0px;
padding:0px;
top:0.5em;
}
#navigation li:hover ul
{
color:#04B4AE;
}
#navigation li li
{
vertical-align:middle;
list-style:none;
display:list-item;
margin:auto;
float:none;
}
#navigation li li a
{
color:#04B4AE;
text-decoration:none;
}
#navigation li li a:hover
{
color:#08298A;
text-decoration:none;
}
you need to set :hover on li :
http://jsfiddle.net/64Grv/1/
li:hover a {color:red}
Try
li:hover a
{
color:yellow;
}
Updated fiddle link is here just changed below
Replace below code
#navigation li a:hover
color:#08298A;
text-decoration:none;
}
with
#navigation li:hover a {
color:#08298A;
text-decoration:none;
}

list item dividers in wordpress menu

I have menu items listed. i have a custom seperator I would like. Currently I have styled the menu items with a background image of the divider positioned to the left. I want to remove the first one.
i.e. my menu looks like this:
/ work / about / resume / contact / store
i want it to look like:
/ work / about / resume / contact / store
menu styled:
.main-nav ul li a {
font-family: 'Roboto Condensed', sans-serif;
font-weight: 300;
font-size: 22pt;
color:#999999;
vertical-align:middle;
text-decoration:none;
display: block;
padding:0;
text-align:center;
width:190px;
float:left;
background-image:url(data/img/navdivider.png);
background-position: top left;
background-repeat:no-repeat;
height:65px;
padding-top:8px;
}
trying to get rid of first one with:
.main-nav ul li a:first-child {
background-image:none;
}
but its not working. what am i doing wrong?
I edited whole answer, because it was wrong.
Problem is that you are targeting a as a :first-child, which always is (its parent is that li element). So, try target with this:
.main-nav ul li:first-child a {
background-image:none;
}

CSS horizontal menus don't work on touch devices

I have a pure CSS implementation of horizontal menus that works fine on browsers on a computer. The website is www.intercessionsp.org. However, on touch devices (specifically, I have tried Safari on iPad and iPhone), the menus do not work. Touching them causes no response at all, if there is a submenu (the Home menu item works fine). I have tried to implement two solutions:
1. using onclick="return true", based on terraling's solution in "iPad/iPhone Touch Event on Hover CSS" question here on stackoverflow.
2. adding #ios ul { display: none; } and #ios li:hover ul { display: block; } based on a post by Philip Renich on elfboy.com called "Making CSS Drop Down Menus Work on the iPhone".
Neither worked.
Here is the relevant part of my css file:
/* horizontal menus */
#nav, .nav, #nav .nav li {
margin:0px;
padding:0px;
}
#nav li {
float:left;
display:inline;
cursor:pointer;
list-style:none;
padding:10px 30px 10px 30px;
border:1px #000 solid;
position:relative;
background: #990000;
}
#nav li ul.first {
left:-1px;
top:100%;
}
li, li a {
color:#fff;
text-decoration:none;
}
#nav .nav li {
width:100%;
text-indent:10px;
line-height:30px;
margin-right:10px;
border-top:1px #000 solid;
border-bottom:1px #000 solid;
border-left:none;
border-right:none;
background:#990000;
onclick="return true"
}
#nav li a {
display:block;
width:inherit;
height:inherit;
}
ul.nav {
display:none;
}
#nav li:hover > a, #nav li:hover {
color:#990000;
background:#fff;
}
li:hover > .nav {
display:block;
position:absolute;
width:200px;
top:-2px;
left:30%;
z-index:1000;
border:1px #000 solid;
}
li:hover {
position:relative;
z-index:2000;
}
#basic li {
color:#000;
}
Since I already have display:block in my li:hover > .nav, I tried adding it to #nav li:hover > a, #nav li:hover (without expecting this one to work) and to li:hover, but neither worked. I should add that I looked at Renich's comment about setting a width value, but since I already had width values set, this didn't appear to be useful.
I would like to stay with a pure CSS implementation.
Your menu relies on the css selector :hover in order to show the list items. In order for those to show on a mobile device like an iphone the user must be able to click. You can try wrapping the text on the first level on your menu with <a> tags. For example: About Us
View this on a mobile device:
http://jsfiddle.net/tlaverdure/L42AE/

LI Background Images (.PNG) not appeared in IE6

I am using the following CSS but it never shows background images in IE6. But if I remove the filter .. AlphaLoader command, then it shows with grey background.
Here is my CSS Code
.fg-block1 ul, .fg-block3 ul
{
list-style:none;
}
.fg-block1 ul li, .fg-block3 ul li
{
padding-left:28px;
background:url(images/bullet-2.png) no-repeat left top;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
border-bottom:1px dotted #fff;
text-align:left;
background-position:1px 0;
line-height:16px;
padding-bottom:5px;
margin-bottom:5px;
}
.fg-block3 ul li
{
border-bottom:none;
}
.fg-block1 ul li a, .fg-block3 ul li a
{
color:#fff;
text-decoration:none;
}
.fg-block1 ul li a:hover, .fg-block3 ul li a:hover
{
color:#fff;
text-decoration:underline;
}
Try reading this :
http://www.twinhelix.com/css/iepngfix/demo/
AlphaImageLoader hack works only if you set dimensions to the parent container where you load your png as a background.
If you add width and height and display:block to your <li>'s it should be fine. Otherwise - consider different approach.
i recommend jQuery png fix. see links below
jQuery plugin
another source
I never tried the jQuery plugin, but after dealing with a lot of PNG problems in IE6 the best fix I found is by far DD Belated PNG fix. The TwinHelix fix mentioned before presented some problems for me in certain scenarios.

Resources