SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Aug 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simple CSS not working in html page


    Hi
    I am try to load a html page using jscript, I am able to load html page successfully by a click on link, but problem is loaded page is not using style sheet.
    Code jscript-
    Code:
    $(function(){
        $('#ul1 li a').on('click', function(e){
            e.preventDefault();
            var page_url=$(this).prop('href');
            $('#content').load(page_url);
        });
    });
    HTML Code:
    <div id="nav" class="image002-03">
    		<span id="smalltext" 
                style="bottom: 0px; margin-bottom: 0px; padding-bottom: 0px; font-family: Calibri; font-size: large; text-align: center;">Service Menu</span>
    		<ul id="ul1" class="serviceul">
    		    <li class="serviceli"><a href="testpage1.htm">Question Papers (unsolved)</a></li>
                <li class="serviceli"><a href="#">Question Papers (solved)</a></li>
                <li class="serviceli"><a href="#">Sample Papers</a></li>
                <li class="serviceli"><a href="testpage2.htm">Notes</a></li>
                <li class="serviceli"><a href="#">Solved Assignments</a></li>
                <li class="serviceli"><a href="#">Projects</a></li>
                <li class="serviceli"><a href="#">Presentations</a></li>
                <li class="serviceli"><a href="#">Uploads</a></li>
                <li class="serviceli"><a href="#">Forum</a></li>
            </ul>
    </div>
    Above code load a testpage1.htm my testpage.htm code is
    HTML Code:
    <head>
        <title>cbse cs n ip</title>
        <link href="css/innerPage.css" rel="stylesheet" type="text/css" />
        
    </head>
    <body>
    <div id="mainbody">
        <div id="bodytext">
            Question Papers (unsolved)
            </div>
            </div>
    </body>
    and innerPage.css contain following style -

    #mainbody
    {
    background-color: #FF3300;
    height: 434px;
    margin-top: 137px;
    }
    #bodytext
    {
    font-size: large;
    font-weight: bold;
    width: 214px;
    color: #CC0099;
    }
    Above css is not working. Totally confused

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,294
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    What do you mean by 'doesn't work"? According to your code, you should end up with a page basically like this:

    Code:
    <head>
        <title>cbse cs n ip</title>
        <style>
    	    #mainbody
    {
    background-color: #FF3300;
    height: 434px;
    margin-top: 137px;
    }
    #bodytext
    {
    font-size: large;
    font-weight: bold;
    width: 214px;
    color: #CC0099;
    }
    	    
        </style>
        
    </head>
    <body>
    <div id="mainbody">
        <div id="bodytext">
            Question Papers (unsolved)
            </div>
            </div>
    </body>
    This works. So perhaps the link to your style sheet is wrong? Where is the style sheet in relation to this new page?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •