PDA

View Full Version : url link behaviors


Pegasuspg
04-07-2010, 10:43 AM
This is pretty basic and in previous Dreamweavers the answer was simple but in CS4 I can't find the way to force a link (to an external site) to open in a new tab or window.

At the same time i want to change the behavior of these randomly placed info links ( non menu items) - colour, visted, etc. I suspect that this is somewhere in the body definition in code land but I don't see it.

anyone know the answer to this basic Q?

thanks

Corrosive
04-07-2010, 11:25 AM
Add target="_blank" to your links for a dirty way to force a new page. There is a web standards way using javascript as well but you'll need to Google that.

You can change link styles by defining a: link, a: visited, a: hover and a: active in your CSS. You can make them div or area specific by specifying an ID or class.

Pegasuspg
04-07-2010, 02:47 PM
thanks again. The first fixes it up perfectly. However the second issue is not so easily fixed with a css. It seems the css is being over powered by a another rule somewhere else. I've transferred the site I'm working on from a much earlier version of dreamweaver to this CS4 version. In the older version there was a page preference panel where you set the actions of links. That basic command seems now to be controlled by css but I'm lost at finding the connection.

Corrosive
04-07-2010, 03:53 PM
However the second issue is not so easily fixed with a css.

Yes it is, it is the ONLY way to fix this problem. I can only give examples as you have given us no code but...

This will style all your links the same way;

a:link {styles here}
a:visited {styles here}
a:hover {styles here}
a:active {styles here}

If you want to override this in a specific div, say a div with the id of #maincontent, then you'd still use CSS;

#maincontent a:link {styles here}
#maincontent a:visited {styles here}
#maincontent a:hover {styles here}
#maincontent a:active {styles here}

CS4 was designed to encourage users to handle CSS correctly and so some of the 'point and click' options are gone (or well hidden). There may be a way to change preferences but you still need to understand CSS.

Pegasuspg
04-07-2010, 06:41 PM
I'll try that out and see if it's a fix. In the mean time I was going to send you a screen shot to demo the prob but I guess I can't since it's unpublished at the moment. If you saw it though you'd note that the active link is a dark blue and barely perceptible against the #003 bg.

I'm assuming the problem is located in the template code and will proceed with your suggestion but in the meantime here's the whole code deal from the template- groan.

I can live with it but it sure would be good to have more contrast.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<style type="text/css">
<!--
body {
background: #003;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: left; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
font-family: Tahoma, Geneva, sans-serif;
}
.thrColAbsHdr #container {
position: relative; /* adding position: relative allows you to position the two sidebars relative to this container */
width: 1000px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
background: #003;
margin: 0 auto;
text-align: left; /* this overrides the text-align: center on the body element. */
}

/* Tips for absolutely positioned sidebars with header and footer:
1. Absolutely positioned (AP) elements must be given a top and side value, either right or left. (As a default, if no top value is given, the AP element will begin directly after the last element in the source order of the page. This means, if the sidebars are first element in the #container in the document's source order, they will appear at the top of the #container even without being given a top value. However, if they are moved later in the source order for any reason, they'll need a top value to appear where you desire.
2. Absolutely positioned (AP) elements are taken out of the flow of the document. This means the elements around them don't know they exist and don't account for them when taking up their proper space on the page. Thus, an AP div should only be used as a side column if you are sure the middle #mainContent div will always contain the most content. If either sidebar were to contain more content, that sidebar would run over the bottom of the parent div, and in this case the footer as well, and the sidebar would not appear to be contained.
3. If the above mentioned requirements are met, absolutely positioned sidebars can be an easy way to control the source order of the document.
4. If the source order is changed, the top value should be equal to the height of the header since this will cause the columns to visually meet the header.
*/
.thrColAbsHdr #header {
height: 288px; /* if you're changing the source order of the columns, you'll may want to use a height on the header so that you can give the columns a predictable top value */
background: #003;
padding: 0px 0px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
text-align: center;
}
.thrColAbsHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
text-align: center;
font-size: 288%;
}
.thrColAbsHdr #sidebar1 {
position: absolute;
top: 310px;
left: 0;
width: 150px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
background: #003; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 15px 10px 15px 20px; /* padding keeps the content of the div away from the edges */
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.thrColAbsHdr #sidebar2 {
position: absolute;
top: 321px;
right: -2px;
width: 177px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
background: #003; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 5px 5px 15px 5px; /* padding keeps the content of the div away from the edges */
text-align: center;
color: #FF6;
}
.thrColAbsHdr #mainContent {
margin: 0 200px; /* the right and left margins on this div element creates the two outer columns on the sides of the page. No matter how much content the sidebar divs contain, the column space will remain. */
padding: 0 5px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
background-color: #FFF;
}
.thrColAbsHdr #footer {
padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
}
.thrColAbsHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
-->
</style><!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.thrColAbsHdr #sidebar1 { width: 180px; }
.thrColAbsHdr #sidebar2 { width: 190px; }
</style>
<![endif]-->
<link href="../CSS/words.css" rel="stylesheet" type="text/css" />
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../CSS/PPMenuBaraVertucal.css" rel="stylesheet" type="text/css" />
</head>

<body class="thrColAbsHdr">

<div id="container">
<div id="header">
<!-- end #header -->
<!-- TemplateBeginEditable name="image" --><!-- TemplateEndEditable --></div>
<div id="sidebar1">
<ul id="Pegasus" class="MenuBarVertical">
<li><a href="../index.htm" title="home">Home</a></li>
<li><a href="../Pages and pdf/Tandem.htm" class="PegasusVertical"><span class="PegasusVertical">Tandem Fligh</span>t</a></li>
<li class="PegasusVertical"><a class="PegasusVertical">The School</a>
<ul>
<li class="PegasusVertical"><a href="../Pages and pdf/The School.htm">The School</a></li>
<li class="PegasusVertical"><a href="../Pages and pdf/Getting There.htm" class="PegasusVertical">Getting There</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Learning To Fly</a>
<ul>
<li><a href="../Pages and pdf/instruction.htm" target="BEGINNER">The Complete Beginner</a></li>
<li><a href="../Pages and pdf/instruction.htm" target="Novice">Novice</a></li>
<li><a href="../Pages and pdf/instruction.htm">Intermediate</a></li>
<li><a href="../Pages and pdf/instruction.htm" target="Private">Private</a></li>
<li><a href="../Pages and pdf/Instructcourse.htm">Instructor's Course</a></li>
<li><a href="../Pages and pdf/Schedule.htm">Course Schedule</a></li>
</ul>
</li>
<li><a href="../Pages and pdf/FAQs.htm">FAQ's</a></li>
<li><a href="#" class="MenuBarItemSubmenu">Flying Sites</a>
<ul>
<li><a href="../Pages and pdf/top map.htm">Top Map</a></li>
<li><a href="../Pages and pdf/Parrsboro Area Sites.htm">Local Flying Sites</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Equipment</a>
<ul>
<li><a href="../Pages and pdf/Paragliders.htm">Paragliders</a></li>
<li><a href="../Pages and pdf/Harness.htm">Harness</a></li>
<li><a href="../Pages and pdf/Accessories.htm">Accessories</a></li>
<li><a href="../Pages and pdf/Used Equipment.htm">Used Gear</a></li>
<li><a href="../Pages and pdf/Accessories.htm">T Shirts</a></li>
</ul>
</li>
<li class="MenuBarItemHover"><a class="MenuBarItemSubmenu" href="#">News</a>
<ul>
<li><a href="../Pages and pdf/photo_gallery.htm">Photo Gallery</a></li>
<li><a href="../Pages and pdf/news.htm">News</a></li>
<li><a href="../Pages and pdf/Festival gallery.htm">Festival Gallery</a></li>
<li><a href="../Pages and pdf/Festival.htm">Festival</a></li>
</ul>
</li>
<li><a href="../Pages and pdf/links.htm">Links</a></li>
<li><a href="../Pages and pdf/Contact Info.html">Contact</a>
<!-- end #sidebar1 -->
</li>
<li><a href="http://www.theweathernetwork.com/weather/cans0106">Weather Network</a></li>
<li><a href="http://www.lau.chs-shc.gc.ca/cgi-bin/tide-shc.cgi?queryType=showFrameset&amp;zone=30&amp;language=en glish&amp;region=5&amp;stnnum=247"> Fundy Tide Tables</a></li>
</ul></div>
<div id="sidebar2">
<!-- end #sidebar2 -->
<!-- TemplateBeginEditable name="rtSideBar" --><!-- TemplateEndEditable --></div>
<div class="thrColAbsHdr" id="mainContent">
<!-- TemplateBeginEditable name="text" --><!-- TemplateEndEditable -->
</div>
<div id="footer">
<!-- end #footer --></div>
<!-- end #container --></div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("Pegasus", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>

gentleone
04-07-2010, 09:20 PM
a: link {styles here}
a: visited {styles here}
a: hover {styles here}
a: active {styles here}If you want to override this in a specific div, say a div with the id of #maincontent, then you'd still use CSS;

#maincontent a: link {styles here}
#maincontent a: visited {styles here}
#maincontent a: hover {styles here}
#maincontent a: active {styles here}

Huh, Corrosive?!? What's that with the spaces in between the anchor and the pseudo classes? That's not going to work. ;)

rectification:

a:link {styles here}
a:visited {styles here}
a:hover {styles here}
a:active {styles here}

Corrosive
04-08-2010, 05:58 AM
:oops: Yes, you are right! Copy and paste...Does it save time or compound a mistake? Discuss. Lol.