No replies
Jelle
Jelle's picture
Offline
newbie
Last seen: 7 years 18 weeks ago
Timezone: GMT+2
Joined: 2013-05-16
Posts: 1
Points: 2

Hello all!

I am having a tiny bit of trouble with CSS and a link style. I want it to have inline-block, which does work on some pages but on other it just won't show.

It shows the text as white, which is set in the link style class of the CSS:

.link-style {
	display: inline-block;
	margin-top: 10px;
	padding: 5px 15px;
	background: #000000;
	letter-spacing: 1px;
	text-decoration: none;
	color: #FFFFFF;
}

As said it does read the color and I can change the text color from white to black, but it just won't show the inline-block. It shows the block on the index page but once I go to profile page it just won't show it.

The index.php:

<?php session_start(); ?>
<html>
<head>
<!-- Set fonts and charset plus general information of the site -->
<title>Welcome to ******</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<!-- Using googles fonts and the css file -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600" rel="stylesheet" type="text/css" />
<link href="css/css.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<!-- The whole wrapper around the site -->
<div id="wrapper">
        <!-- Start header -->
	<div id="header">
		<div id="logo">
			<!-- Ready for text on top picture -->
		</div>
	</div>
	<!-- Start login info -->
	<div id="login">
	    <?php
		//$member = unserialize($_SESSION['member']);
 
		if ( isset($_SESSION['member_id']) )
		{
		    printf("Welcome %s (%s %s)! <a href='logout.php'>Sign out</a>", $_SESSION['username'], $_SESSION['first_name'], $_SESSION['last_name']);
		}
 
		else
		{
		    printf('<a href="login.php">Login</a>');
		}
	    ?>
	</div>
	<!-- Start menu -->
	<div id="menu-wrapper">
		<div class="ribbon ribbon-content">
			<div id="menu">
				<ul>
					<li class="current_page_item"><a href="index.php">Home</a></li>
					<li><a href="profile.php">Profile</a></li>
					<li><a href="tournaments.php">Tournaments</a></li>
					<li><a href="gyms.php">Gyms</a></li>
                                </ul>
			</div>
		</div>
	</div>
        <!-- start content -->
	<div id="columns">
		<div class="content">
                        <!-- post news -->
			<div id="column1">
                            <?php
 
                                //Sample button for admins
				if ( isset ($_SESSION['member_id']) )
				{
				    include_once 'php/Role.php';
 
				    $memberrole = new MemberRoleController();
				    $roles = $memberrole->getRolesByMemberID($_SESSION['member_id']);
 
				    foreach ( $roles as $role )
				    {
					if ( $role->role === "Admin")
					{
					    echo '<p><a href="write_news.php" class="link-style">Write new news</a></p>';
					}
				    }
				}
 
                                //include the news.php file for showing and publishing news
                                include 'php/News.php';
 
                                $NewsController = new NewsController();
                                $newsarray = $NewsController->getNews(3);
 
 
                                //Publish news on the front page
                                foreach ($newsarray as $news)
                                {
                                    printf('<h2>%s</h2>
                                    <p><img src="%s" width="680" height="200" alt="" /></p>
                                    <p>%s - %s</p>', $news->headline, $news->Image, $news->date, $news->content);
                                }
                                    unset($NewsController);
                                echo '<p><a href="all_news.php" class="link-style">More...</a></p>';
                            ?>
			</div>
                        <!-- Start lastest fights -->
			<div id="column2">
                        <?php
			    include_once 'php/latestFights.php';
			?>
			</div>
		</div>
	</div>
        <!-- Footer for copyright notice -->
	<div id="footer">
		<p>Copyright &copy; Uni group Bi405F13</p>
	</div>
</div>
</body>
</html>

You can view the page on http://p4.bitbender.dk, here the index file works fine, and in "latest fights" it does show the inline block.

Now the profile code:

<?php session_start(); ?>
<html>
<head>
<!-- Set fonts and charset plus general information of the site -->
<title>Viewing profile - *****</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<!-- Using googles fonts and the css file -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600" rel="stylesheet" type="text/css" />
<link href="css/css.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<!-- The whole wrapper around the site -->
<div id="wrapper">
        <!-- Start header -->
	<div id="header">
		<div id="logo">
			<!-- Ready for text on top picture -->
		</div>
	</div>
        <!-- Start login info -->
        <div id="login">
	    <?php
                //Check if member_id is set on the session
		if ( isset($_SESSION['member_id']) )
		{
                    //if it is the rest probably is too so print information
		    printf("Welcome %s (%s %s)! <a href='logout.php'>Sign out</a>", $_SESSION['username'], $_SESSION['first_name'], $_SESSION['last_name']);
		}
 
                //if member_id is not set
		else
		{
                    //then print log in
		    printf('<a href="login.php">Login</a>');
		}
	    ?>
	</div>
        <!-- Start menu -->
	<div id="menu-wrapper">
		<div class="ribbon ribbon-content">
			<div id="menu">
				<ul>
					<li class="current_page_item"><a href="index.php">Home</a></li>
					<li><a href="profile.php">Profile</a></li>
					<li><a href="tournaments.php">Tournaments</a></li>
					<li><a href="gyms.php">Gyms</a></li>
                                </ul>
			</div>
		</div>
	</div>
        <!-- start content -->
        <div id="columns2">
		<div class="content">
                        <!-- show menu -->
			<div id="column1">
                            <ul><h2>
                                <li><a href="profile.php">Profile</a></li>
                                <li><a href="edit.php">Edit profile</a></li>
                            </h2></ul>
			</div>
                        <div id="column2">
                            <?php
                                if ( isset($_SESSION['member_id']) )
                                {
                                    printf("<p>%s</p>", $_SESSION['username']);
                                    printf("<img src='images/%s.jpg' alt='%s' width='132' height='99'", $_SESSION['username'], $_SESSION['username']);
                                }
 
                                else
                                {
                                    printf("You are not logged in, log in <a href='login.php'>here</a>");
                                }
                            ?>
                        </div>
                        <div id="column3">
                            <?php
                              if ( isset($_SESSION['member_id']) )
                              {
                                  printf("<p>Name: %s %s</p>", $_SESSION['first_name'], $_SESSION['last_name']);
                                  printf("<p>Age: %s</p>", $_SESSION['day_of_birth']);
                                  printf("<p>Gender: %s</p>", $_SESSION['gender']);
                                  printf("<p>Gym: %s</p>", $_SESSION['gym_id']);
                                  printf("<br />");
 
                                  include_once 'php/Role.php';
 
                                  $memberrole = new MemberRoleController();
                                  $roles = $memberrole->getRolesByMemberID($_SESSION['member_id']);
 
                                  foreach ( $roles as $role )
                                  {
                                      if ( $role->role === "Fighter")
                                      {
                                          printf("<p><b>Fighter Info</b></p>");
                                          printf("<p>Weight class: %s</p>", $_SESSION['weight_class_id']);
                                          printf("<p>Deciplin(<img src="https://www.csscreator.com/sites/all/modules/smileys/packs/Roving/drunk.png" title="Drunk" alt="Drunk" class="smiley-content" />: %s</p>", $_SESSION['decipline']);
                                          printf("<p>Fights fought: %d</p>", $_SESSION['fights']);
                                          printf("<p><a href='fightbook.php' onclick='window.open('fightbook.php', 'newwindow', 'width=500, height=400'); return false;'>Åbn fighter bog</a></p>");
                                          printf("<br />");
                                      }
 
                                      if ( $role->role === "Judge")
                                      {
                                          printf("<p><b>Judge info</b></p>");
                                          printf("<p>Fights judged: %d</p>", $_SESSION['judged']);
                                          printf("<p><a href='%s/judgebook.php' onclick='window.open('%s/judgebook.php', 'newwindow', 'width=500, height=400'); return false;'>Åbn fighter bog</a></p>", $_SESSION['username'], $_SESSION['username']);
                                          printf("<br />");
                                      }
 
                                      if ( $role->role === "Referee")
                                      {
                                          printf("<p><b>Referee info</b></p>");
                                          printf("<p>Fights refereed: %d</p>", $_SESSION['refereed']);
                                          printf("<p><a href='%s/refereebook.php' onclick='window.open('%s/refereebook.php', 'newwindow', 'width=500, height=400'); return false;'>Åbn fighter bog</a></p>", $_SESSION['username'], $_SESSION['username']);
                                          printf("<br />");
                                      }
 
                                      if ( $role->role === "Coach")
                                      {
                                          printf("<p><b>Coach info</b></p>");
                                          printf("<p>Fighters enrolled: %d</p>", $_SESSION['enrolled']);
                                          printf("<p>Fights coached in: %d</p>", $_SESSION['coached']);
                                          printf("<p><a href='%s/coachbook.php' onclick='window.open('%s/coachbook.php', 'newwindow', 'width=500, height=400'); return false;'>Åbn fighter bog</a></p>", $_SESSION['username'], $_SESSION['username']);
                                          printf("<br />");
                                      }
                                  }
                              }
                            ?>
                        </div>
		</div>
	</div>
	<?php
	    if ( isset($_SESSION['member_id']) )
	    {
		printf('<div id="columns4">');
		printf('<div class="content">');
		printf('<div id="column2">');
		include_once 'php/latestFights.php';
		printf('</div>');
		printf('</div>');
		printf('</div>');
	    }
 
	    else
	    {
		printf('<div id="columns3">');
		printf('<div class="content">');
		printf('<div id="column1">');
		include_once 'php/latestFights.php';
		printf('</div>');
		printf('</div>');
		printf('</div>');
	    }
	?>
	<div id="footer">
		<p>Copyright ting her</p>
	</div>
</div>
</body>
</html>

The page is here: http://p4.bitbender.dk/profile.php

here it won't show the inline block, but it still reads that the text color should be white, and I can change that to black.

Furthermore, if I right click on where the box should be and press "Expect element" (FireFox) I can review the CSS code. If I go down to the link style CSS code here, there is an inline of the line where it writes "display: inline-block;" but that does not happen on any of the other pages.

How come I can't get it to show the inline block?

This is my very first time I ever try CSS/HTML/PHP so there might be something weird happening. If you need more information please tell and I'll be happy to share them.

If you want to try the login on the profile page I have created a user:
username: Weee
password: weee

Thanks in advance!