LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-06-2007, 09:11 PM   #1
ssfrstlstnm
Member
 
Registered: Dec 2004
Location: IN, USA
Distribution: debian etch
Posts: 402

Rep: Reputation: 30
CSS width property


Sorry for such a stupid question, but I have been working on this for days. I'm trying to change over to CSS but it isn't as easy as it seems in the tutorials. One of my problems is trying to set the width of elements. I can't seem to set the width for anything. For example I'm trying to make a navigation bar at the top of the page, but I can't get any space in between the links. Man tables seems so much easier:

<style.css>

.nav {
position: fixed;
top: 65px;
left: 5%;
}
.nav * {
position: relative;
display: inline;
width: 20%;
}

<index.php>

<div class="nav">
<b><a href="cv.htm">CV</a></b>
<b><a href="events.php">Events</a></b>
<b><a href="http://del.icio.us/sassman/">Links</a></b>
<b><a href="spgm/index.php">Pictures</a></b>
<b><a href="videos.htm">Videos</a></b>
<b><a href="tunes.htm">Tunes</a></b>
</div>
 
Old 01-06-2007, 10:02 PM   #2
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
Try defining your menu as an inline list, give width, margin and padding values to .nav li. Different browsers treat css differently, so you may need to play with these to see how they behave with different browsers. To get things working correctly in IE, you may have to hide some rules from it in a separate stylesheet, perhaps with @import url(hidefromie.css) screen; in your html headers.
 
Old 01-07-2007, 12:54 AM   #3
firemankurt
LQ Newbie
 
Registered: Jul 2006
Location: Ferndale WA USA
Distribution: MEPIS 6
Posts: 20

Rep: Reputation: 0
Here is Mine:


[HTML]
<div id="subheader">
<a href="index.php">HOME</a>
<hr/>


<ul>
<li><a href="GrpPgChsQik.php">Quick Group Page</a></li>
<li><a href="GrpPgChsQik.php?ToMem=1">Quick Group Member Page</a></li>
<li><a href="MemPgChsQik.php">Quick Member Page</a></li>

<li><a href="GrpPgChoose.php">Pageout Predefined Group</a></li>
<li><a href="MemPgChoose.php">Pageout Select Members</a></li>
<li><a href="chat.php" target="_blank">Chat</a></li>
<li><a href="LogViewer.php">Page Logs</a></li>
<li><a href="MoreIndex.php">More...</a></li>
<li><a href="../myotl/index.php">Overtime Tracking</a></li>

</ul>

</div> <!-- subheader -->
[/HTML]

and CSS is:
[HTML]
#subheader{
line-height: 1.5em;
background-color: #C0C0C0;
width: 90%;
text-align: center;
padding: 0 5%;
}


#subheader ul{
text-align: center;
margin-left: 0;
margin-top:0;
margin-bottom:0;
padding-left: 0;
}

#subheader li{
list-style-type: none;
padding: 0.25em 1em;
border-left: 1px solid black;
display: inline
}

#subheader li:first-child {
border: none;
}
[/HTML]
 
Old 01-07-2007, 03:04 PM   #4
petersum
Member
 
Registered: May 2006
Location: Karachi, Pakistan
Posts: 140

Rep: Reputation: 15
A div should have four items - left, top, width, height - as a minimum. You can omit the width and height if you want the div to resize according to the content, but that can create lots of problems as different browsers and OS's use different fonts. Therefore, you risk one div merging into the next one.
Try to use fixed px sizes as percentages are not correctly recognized by all browsers.

Your divs should never be full - leave a little "whitespace" because it looks better - believe me!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does Linux have a Property Management app? tigerflag Linux - Software 10 05-20-2008 02:05 PM
JavaScript: Changing a class property tumana Programming 2 02-15-2006 01:35 AM
xcomposite: transparency property Sinope Linux - General 0 10-21-2004 08:37 PM
vsFTPd file property options zix99 Linux - Networking 3 10-14-2003 10:25 AM
Property ownership? BajaNick General 14 09-15-2003 07:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration