0

I am redesigning a client's website so they will be able to edit the website themselves. What I intend on doing is have the main "Front End" pages with a mix of html and php in them. The html renders the page while the php includes a external menu and grabs the content for the individual page allowing the content to be safely edited without harming the main page.

Now the problem is a have a CSS document linked that loads the menu I have two of these however whats happening is that i added some javascript to detect screen size and load a different css document if the screen is smaller then a certain size, however the website is seemingly loading half the css, it formats the menu but leaves it all in a block.

The version of the site I am working on is available at http://www.letsmine.info/Yoga

The main page without the .php extensions (To prevent the loading of the php) is http://www.letsmine.info/Yoga/index.txt

The menu is http://www.letsmine.info/Yoga/templates/menu.php

I believe the problem is javascript but I am not 100% sure.

7
  • Not the issue, but it will cause you issues: You don't have an opening or closing <ul> or <ol> tag for your navigation <li>s. They are just naked in the <div> Commented May 28, 2011 at 5:02
  • @Wesley I know that, each <li> doesn't need a <ul> if you look at the css document letsmine.info/Yoga/css/drop.css you will understand. I may also noted i changed my javascript in a local copy to do the same thing in a similar manner, it still didn't work. Commented May 28, 2011 at 5:07
  • 1
    @Jason: If you look at your validation results and how to use a list in HTML you will understand. Commented May 28, 2011 at 5:10
  • @Wesley Hadn't got to validating it yet, code was still correct but not the valid way of doing it. I validated the code and because of my css stylesheet it hid the menu items but even hidden they were still placed wrong @Chrome Inspect Element. I will get a proper validated version up once i have fixed the css, meanwhile it is not the problem. Commented May 28, 2011 at 5:28
  • 1
    @Jason: Yes I do realize from looking at your page that it's not the problem, but asking people to debug what you know is invalid code is generally inconsiderate in my book. It should have been the first thing you tried. Commented May 28, 2011 at 5:30

2 Answers 2

2

Change the order of your included files.

Currently you have this:

<script type="text/JavaScript"> 
var screenwidth = screen.width;
if (screenwidth < 1180){
document.write('<link rel="stylesheet" href="css/ldrop.css" type="text/css" media="screen" />');
}
else
{
document.write('<link rel="stylesheet" href="css/drop.css" type="text/css" media="screen" />');
}
</script> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 
<title>Alignment Courses</title> 
<link href="css/styles.css" rel="stylesheet" type="text/css" /> 

Change it to this:

<link href="css/styles.css" rel="stylesheet" type="text/css" /> 
<script type="text/JavaScript"> 
var screenwidth = screen.width;
if (screenwidth < 1180){
document.write('<link rel="stylesheet" href="css/ldrop.css" type="text/css" media="screen" />');
}
else
{
document.write('<link rel="stylesheet" href="css/drop.css" type="text/css" media="screen" />');
}
</script> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 
<title>Alignment Courses</title> 

Reason? The last CSS document to be loaded takes precedence. So load the default styles first and the overriding styles last.

Sign up to request clarification or add additional context in comments.

2 Comments

Doesn't completely make sense, there shouldn't be any overriding of styles as styles.css is just a default css to load and drop.css and ldrop.css are additional however I understand what you are saying. Something probably hidden in that styles.css ... I need to clean it up.
Thank you now it is up to me to clean out that styles.css!
0

increase the width of #nav in style.css..

3 Comments

The width is not set, the elements should float themselves along side of each other. Good point though i will try setting the width as 100%
same id,s used their in drop.css and style.css, now you increased width and overrides style.css by drop its done.
Already answered, by ordering it right i override the id in the styles.css . I actually hadn't realised there was a id that was causing the problem previously. This was actually already answered but thank you anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.