Solved

Basic Joomla Menu + CSS

Posted on 2008-10-18
4
632 Views
Last Modified: 2012-05-05
Hi,

I'm working on a Joomla template, but I'm having a bit of trouble get a custom menu to work.

http://qecomm.com/template.html

The above site is just a basic structure I am working with, I will then put in the Joomla tags after that. I'm trying to get the Joomla menu to work the same as the menu in Template.html.

Most of the Joomla template tutorials say to use something like <jdoc:include type="modules" name="topmenu" /> to display the menu. I'm using mod_mainmenu with Legacy - Horizontal. The menu displays fine, but it is just a big clump of links, like:

HomeAbout UsContact UsE-Newsletter

Is their a way to separate the links so that I can put <li> tags around each seperate link etc. In PHP you could just loop through a query and apply whatever options you want to each variable. Just looking for someone who knows how the Joomla system works in regards to the above situation? Or is their a website that describes how all this works?
0
Comment
Question by:qdh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Expert Comment

by:brundo
ID: 22751379
Hi,

I have a similar situation... In the top menu I have no submenus, but only links. So my menu is defined as Legacy - Flat list.

So I get an ul with id="mainlevel-nav", inside a div with id="topmenu". The keypoints are defining width and display:block, as you can see in following example (made from my homepage):




<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-en" lang="en-en" dir="ltr" >
 
<head>
	<title>Test</title>
 
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<style type="text/css">
 
#topmenu {
	float: right;
}
 
#mainlevel-nav {
	list-style: none;
}
#mainlevel-nav li {
	float: left;
	margin-left: 10px;
	text-align: center;
}
#mainlevel-nav a {
	width: 160px; 
	display: block;
	color: #ffffff;
	background: #000099;
	text-decoration: none;
}
#mainlevel-nav a:hover {
	background: #000033;
}
	</style>
 
</head>
<body>
 
<div id="topmenu">
	<ul id="mainlevel-nav">
		<li><a href="/index.php" class="mainlevel-nav" >Home</a></li>
		<li><a href="/index.php?option=com_contact&amp;Itemid=18" class="mainlevel-nav" >Contacts</a></li>
		<li><a href="/index.php?option=com_weblinks&amp;Itemid=122" class="mainlevel-nav" >Links</a></li>
	</ul>
</div>
 
</body>
</html>

Open in new window

0
 

Author Comment

by:qdh
ID: 22751656
So if someone enters a new menu item you have to enter it manually into your code?
0
 
LVL 13

Accepted Solution

by:
brundo earned 250 total points
ID: 22751814
No, this is an example made of generated page :-))

You have different names in your template, so, here is the code you have to add to your CSS... or - in example, in the style definition - e.g. after ul.topmenulist li definition. As I wrote in my previous message, important parts are width and display:block.

.topmenulist a {
	width: 160px; 
	display: block;
	color: #ffffff;
	background: #000099;
	text-decoration: none;
}
.topmenulist a:hover {
	background: #000033;
}

Open in new window

0
 
LVL 44

Assisted Solution

by:scrathcyboy
scrathcyboy earned 250 total points
ID: 22754196
If you are trying to change a joomla template, you are best to ADD your CSS to the main CSS that the template file uses.  You can get problems putting your CSS in a separate file than the main CSS file.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cannot center boxes on mobile, but looks good on desktop 9 56
Hiding Adsense on Mobile Devices 2 46
Fix a css menu for width 15 33
bootstrap css color change 10 19
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question