Working with one of the out of the box templates, I noticed side bars with several links. Each link had its own container with a background color and everything. Essentially I want to know how to take a container in my header and change it into the same kind of link (only of course keep it in the header).
Did you look at the code and try to copy that method?
The links are ordinary HTML anchors contained in an unordered list -
<ul class="nav">
<li><a href="#">Link one</a></li>
<li><a href="#">Link two</a></li>
<li><a href="#">Link three</a></li>
<li><a href="#">Link four</a></li>
</ul>
They work the way they do because of the CSS that targets links in the sidebar -
ul.nav {
list-style: none; /* this removes the list marker */
border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
margin-bottom: 15px; /* this creates the space between the navigation on the content below */
}
ul.nav li {
border-bottom: 1px solid #666; /* this creates the button separation */
}
ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
padding: 5px 5px 5px 15px;
display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
width: 160px; /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */
text-decoration: none;
background-color: #C6D580;
}
ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
background-color: #ADB96E;
color: #FFF;
}
Are you code-savvy enough to work your way through that? If not, be aware that DW will quickly become very frustrating for you without this kind of knowledge under your belt. The application will expect you to bring that to the table....
I've figured much out actually.
I created a CSS class called "donationslice" (I'm trying to create a "donation" button specfically) which displays a "block" around the item it is applied to and specified it's border and size. This creates the border and allows me to put a background color or image in place.
However simply applying this to an item and then linking that item doesn't work. Then only the words or image become a link. The item which the class is applied needs to already be a link for the entire block to become a link. I will admit that I don't know the reason for this disparaity though.
I did only take an introductory class for dreamweaver. It introduced some elements of XHTML and CSS but they weren't really the focus. Yes this is frustrating, but if you want to learn to swim you have to jump in the water you know?
Okay, upon further investigating, I discovered the disparity was caused by what the CSS was being applied to specifically. Let's say you linked a word. If the item was already a link Dreamweaver defaulted to attaching the class to the link itself. Thus the entire block is then linked. This means deleting the link disassociates it from the special CSS class. However if the word is linked after the class is applied, the CSS is still applied to the word, thus the entire block will not be linked.
Really upon investigation, this has nothing whatsoever to do with the XHTML or CSS of the page itself before the creation of the new rule and linked item. Unless you have a rule that already somehow contradicts the new class rule.
Let's say you linked a word. If the item was already a link Dreamweaver defaulted to attaching the class to the link itself
Actually, you probably 'told' DW to do that with the following workflow:
1. Select the word in Design view
2. Use the Class field of the Property inspector to apply the class
The resulting HTML would look like this - <a href="..." class="whatever">whatever</a>
On the other hand, if your workflow was this -
1. Select the word
2. Apply the class using the Class field of the Property inspector
3. With the word selected enter the link in the link field
the resulting HTML would look like this - <a href="..."><span class="whatever">whatever</span></a>
In the first case, removing the link would also remove the class reference since the class is applied directly to the <a> tag. In the second case, removing the link would leave the class reference on the containing <span> tag. There is no functional difference in the behavior of the two links (i.e., whether the class is applied directly to the anchor tag or to a containing span tag). Which method is optimal for your purposes really depends on how you want to structure your CSS, and what you intend to do with the additional <span> tag.
North America
Europe, Middle East and Africa
Asia Pacific