11 Replies - 950 Views - Last Post: 26 January 2013 - 11:43 AM Rate Topic: -----

#1 Log1ck  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 22-January 13

NEWBIE PHP Nav bar question

Posted 26 January 2013 - 06:08 AM

I made a layout. The nav bar is very simple.

<div id="nav">

	<a href="index.php">Home</a>
	<a href="about.php">About</a>
	<a href="portfolio.php">Portfolio</a>
	<a href="contact.php">Contact</a>
	<a href="login.php">Login</a> - <a href="register.php">Sign Up</a>

</div> <!-- end #nav -->


My question is, where are the parameters that distinguish the size of these "buttons".

If you goto my site,

http://www.logick.xp3.biz

You will see what I am talking about. Anyone have any idea?
It deff isnt in the styles.css or in the nav.php
I dont remember making these parameters, so is this some kind of default?

Is This A Good Question/Topic? 0
  • +

Replies To: NEWBIE PHP Nav bar question

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3710
  • View blog
  • Posts: 5,958
  • Joined: 08-June 10

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 06:36 AM

Hey.

It is in your styles.css file.

You can use the browser developer tools to figure things like this out. For example, in Chrome you can just right click elements and do "Inspect Element" to get the dev tools up. Then you can look at he right side of the element inspection tab to see exactly what styles are applied and where they come from.

Posted Image
Was This Post Helpful? 1
  • +
  • -

#3 Log1ck  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 22-January 13

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 06:46 AM

AHH. Thank you!! I saw the other Nav's within the css, but wasnt thinking about it at all. That makes perfect sense.

Thanks much. Deff going to take advantage of those tools.
Was This Post Helpful? 0
  • +
  • -

#4 Log1ck  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 22-January 13

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 06:53 AM

hmm.. I still cant seem to change the "white box" size around the text. I tried changing the height on "nav a" and even tried adding a height to "nav" but got nothing.

:-\

just took another look at your image. BACKGROUND COLOR. got it. Thanks bud.
Was This Post Helpful? 0
  • +
  • -

#5 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3710
  • View blog
  • Posts: 5,958
  • Joined: 08-June 10

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 06:56 AM

Those are display: inline; elements, so their dimensions aren't controlled by "height" and "width" styles, but rather the size of their contents. The "padding" and "margin" styles, however, do affect them.

Try changing it to display: inline-block;. That should let you specify heights and widths like you would on a block element. Be warned, though: it is not supported on older versions of IE. (IE7 and down, if I remember correctly.) The alternative is to set display: block; and use float: left; to get them to align horizontally.
Was This Post Helpful? 1
  • +
  • -

#6 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,000
  • Joined: 08-August 08

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 07:52 AM

Note that this has nothing to do with PHP, other than that it serves as an example of the distinction between server side (PHP) and client side (HTML, Javascript, CSS, etc.) code.
Was This Post Helpful? 0
  • +
  • -

#7 Log1ck  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 22-January 13

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 08:03 AM

View PostAtli, on 26 January 2013 - 06:56 AM, said:

Those are display: inline; elements, so their dimensions aren't controlled by "height" and "width" styles, but rather the size of their contents. The "padding" and "margin" styles, however, do affect them.

Try changing it to display: inline-block;. That should let you specify heights and widths like you would on a block element. Be warned, though: it is not supported on older versions of IE. (IE7 and down, if I remember correctly.) The alternative is to set display: block; and use float: left; to get them to align horizontally.



Thanks a bunch. Youve been more than helpful. Now I have a better understanding.

CT - Ya, this is deff more CSS than anything else, but im new to both and my site is running on php. So reguardless of what it is, if i ever have any questions, im probably going to post here. Help is help right? :)
Was This Post Helpful? 0
  • +
  • -

#8 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,000
  • Joined: 08-August 08

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 08:55 AM

You should post CSS questions in the CSS forum and HTML questions in that forum. You'll get faster help when you post in the relevant forums since the people watching a particular forum tend to know more about that subject. In addition, others looking for help on a particular subject will have more relevant topics to read.

This post has been edited by CTphpnwb: 26 January 2013 - 08:55 AM

Was This Post Helpful? 0
  • +
  • -

#9 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,000
  • Joined: 08-August 08

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 09:18 AM

Since this is the PHP forum and I don't want to just move this topic I'm going to try to bring the subject around to PHP.

Look and your code from post #1. It can work, assuming the PHP files are correct, but it shows that you're likely making a critical beginner mistake because it looks like you think that the HTML calls PHP files. It does not.

Your code doesn't run any PHP. What's happening if this is a PHP file is that the PHP interpreter is passing the HTML in this file to the server which then passes it to the browser which creates the links. When a link is clicked the browser sends a request to the server to run the script from the link. The server then loads and executes the PHP script and the process repeats itself.
Was This Post Helpful? 1
  • +
  • -

#10 Log1ck  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 22-January 13

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 09:38 AM

I think i understand what you saying, but what would be a good alternative to do this same thing but with php code?

If so, would the php code be more efficient?

Right now, that file is in fact a php file and the links are correct. Since this is under an ID it allows me to make changes quickly. I figured that was a point to use php, quick customization.

So this code is nav.php which is using the style.css then used on the index.php which is running this code:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<meta name="description" content="" />

<meta name="keywords" content="" />

<meta name="author" content="" />

<link rel="stylesheet" type="text/css" href="style.css" media="screen" />

<title>Logick Entertainment</title>

</head>

	<body>

		<div id="wrapper">

<?php include('includes/header.php'); ?>

<?php include('includes/nav.php'); ?>

<div id="content">

<!--You can use <h1>-<h5> tags for headers -->

<h1>Still in Development</h1>

<h3>Future Plans</h3>

<p>

This website is still underconstruction.  Hopefully soon, there will be something useful right here.  :)/>

</p>



</div> <!-- end #content -->

<?php include('includes/sidebar.php'); ?>

<?php include('includes/footer.php'); ?>
		
		</div> <!-- End #wrapper -->
	
	</body>

</html>




Would that be efficient for a php file?
Was This Post Helpful? 0
  • +
  • -

#11 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,000
  • Joined: 08-August 08

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 10:20 AM

The computers don't care which way it's done. The issue is what happens when the project grows. Can you still read (and understand) it?

The history of computer languages is all about breaking large problems up into smaller problems and solving them one at a time. Mixing languages flies in the face of this and it's why many beginners run into trouble. If you use php as a template engine and treat html files as templates you can keep your code organized and readable.
Was This Post Helpful? 1
  • +
  • -

#12 Log1ck  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 22-January 13

Re: NEWBIE PHP Nav bar question

Posted 26 January 2013 - 11:43 AM

That is VERY helpful. Thank you very much for that. Right now my layout is pretty clean as far as organization, but I see how your methods can easily make this MUCH cleaner, especially in the long run. An array is very useful. Ill be sure to implement this with my code.

Thanks much guys. This post alone was a lesson learned. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1