Problem with header CSS

Problem with header CSS

by Wonton Sopabuena -
Number of replies: 3

Hello everyone!

In my website's header I have my logo (almost at the top-left of the page) and a link to other website (just on the right of the logo).

Everything goes OK but the attempt quiz page. When I enter in this page (for any of my quizzes), the link goes to the right of the page!

If it helps, this is part of my header code:

<div id="page">
<?php //Accessibility: 'headermain' is now H1, see theme/standard/styles_layout.css: .headermain
if ($home)
{  // This is what gets printed on the home page only
?>
    <?php print_container_start(true, '', 'header-home'); ?>
        <div class="headermain"><img src="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/logo.png" alt="My site" title="My site" id="logo" /></div>
<div class="linkbackclass">
<a href="http://othersite.com"> Go to other site</a>
</div>
    <?php print_container_end(); ?>
<?php
}
else if ($heading)
{  // This is what gets printed on any other page with a heading
?>
    <?php print_container_start(true, '', 'header'); ?>
        <div class="headermain"><img src="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/logo.png" alt="My site" title="My site" id="logo" /></div>
<div class="linkbackclass">
<a href="
">http://othersite.com"> Go to other page</a>
</div>
<h2 class="headermain"><?php echo $heading ?></h2>
    <?php print_container_end(); ?>
<?php } ?>

And this is part of my styles_fonts.css:

div.linkbackclass{

font-weight:bold;

padding-top: 1em;

font-size: 0.75em;

color:red;

}

.linkbackclass a {

color:red;

}

.headermain {

font-weight: bold;

margin-top: 0.63em;

margin-left: 0.2em;

margin-right: 1em;

}

h2.headermain {

margin-top: 0.35em;

}

#header h2.headermain {

font-size: 1.7em;

font-weight: normal;

font-family:Verdana;

}

I don't know where to look at, so, any of you could help me? Why my CSS is wrong with the attempt page?

Average of ratings: -
In reply to Wonton Sopabuena

Re: Problem with header CSS

by dan roggenkamp -
Does that only happen on a quiz page? Does it happen on any other page, such as a forum page or activity page?

This line of code:

<a href="
">http://othersite.com"> Go to other page</a>

should be

<a href="http://othersite.com">Go to other page</a>

but assuming that line just got messed up when you were editing your message, and that it's actually OK in your theme, then you might try adding a float:left; tag to your
div.linkbackclass.

In reply to dan roggenkamp

Re: Problem with header CSS

by Wonton Sopabuena -

Hello dan!

Yes, the mistake in "<a href="">http://othersite.com"> Go to other page</a>" was a Copy&Paste problem wink, my original line is OK.

This problem only happens in the quiz attempt page, neither in the quiz information page, nor in the activity page, or in any other page I'va seen this problems happens.

I've tried adding your "float: left" line and now the link always appears where I want, but the problem now is that the course title (which appeared below the link) now appears just on the right of the link, very near of the right of the page, so a long title will appear in two lines.

I think your solution is very near of what I'm looking for, I will keep ivestigate it.

Thank you very much!

In reply to Wonton Sopabuena

Re: Problem with header CSS

by Wonton Sopabuena -

Sorry for answering myself, but I've discovered something and I hope it helps.

I've seen that the unique difference in the header where link appears in the wrong place is this:

<body class="mod-quiz course-2 dir-ltr lang-es_utf8" id="mod-quiz-attempt">

When with any other page, for example, with the quiz/view.php page this line appears as:

<body class="mod-quiz course-2 dir-ltr lang-es_utf8" id="mod-quiz-view">

I know that this line is written in header.html, here:

<body<?php

echo " $bodytags";

if ($focus) {

echo " onload=\"setfocus()\"";

}

?>>

but I think is a problem of the mod-quiz-attempt CSS. I've been investigating this but I don't now too much about CSS so I'm lost.

Could you help me with this?

Thank you very much!