Page 1 of 1

change link color just in entries.tpl

Posted: Sat Jun 23, 2007 9:01 am
by celect
I want to change the color of my links in my entries to my blog and then I want different link colors for my sidebars, such as my calendar and archives links. For example I want my calendar and archive links in my side bar to be black but my links in my entries to be a dark orange. How would I go about doing this?

And since I am on this. How would I specifically edit each individual side bar item. Such as if I wanted to align all the my archive links to the left but in my calendar side bar I want all the links centered?

I have edited the lady bird template.

BTW check out my blog at whowantsnews.com/cblog to get what I am talking about

Posted: Sat Jun 23, 2007 10:02 am
by PHPaws
A quick-fix would be to install the HTML-Head-Nugget ( Event-Plugins => Backend: Meta Informations => HTML-Head Nugget)

(I'm not entirely sure about what it's called in the english version of S9Y since I use the german version)

When it's installed, open the plugins preference dialog and input the CSS directly into the text field:

Code: Select all

<style type="text/css">
<!--
.serendipity_entry_body a,
.serendipity_entry_body a:visited {
  color: #F38913;
  font-weight: bold;
  text-decoration: none;
}
.serendipity_entry_body a:hover {
  color: #F38913;
  font-weight: bold;
  text-decoration: underline;
}
-->
</style>
As for your Archive links this should help:

Code: Select all

<style type="text/css">
<!--
.container_serendipity_archives_plugin {
  text-align: left;
}
-->
</style>
I hope I could help. :)

Posted: Sat Jun 23, 2007 8:53 pm
by Don Chambers
I have to disagree with the suggestion above. No reason to use embedded styles - modify your style.css file directly.

Somewhere, you are setting a text-align: center that is applying to everything unless that element is specifically styled otherwise.

To left align most of what you want, find the class .serendipitySideBarContent and add text-align: left; so that the final result looks like this:

Code: Select all

.serendipitySideBarContent {
  padding: 0 4px;
  font-size: 8pt;
  margin-top: 0;
  text-align: left;
}
For the links, I assume the sidebar links already have the desired color, but you want some of the links in your entries to be orange. Assuming this is the case, you can add this to your style.css:

Code: Select all

.serendipity_entry a{
  color: #F58713;
}
I have targeted different classes than the first response. You can try modifying both classes, one at a time, and see which produces the desired end result.

Also, before you make ANY change to your style.css file, you should make a backup copy of it as it presently exists.

Posted: Sat Jun 23, 2007 9:08 pm
by PHPaws
Don Chambers wrote: To left align most of what you want, find the class .serendipitySideBarContent and add text-align: left; so that the final result looks like this:

Code: Select all

.serendipitySideBarContent {
  padding: 0 4px;
  font-size: 8pt;
  margin-top: 0;
  text-align: left;
}
Wouldn't that also align the calendar to the left?
celect wrote: Such as if I wanted to align all the my archive links to the left but in my calendar side bar I want all the links centered?
I've chosen to modify .serendipity_entry_body insead of .serendipity_entry because he only wants to style links within a post. Styling .serendipity_entry could have adverse effects on any link in this container.

Still, I have to agree with modifying the stylesheet directly. But not everybody is able or feeling up to do that. :)

Paws ^^

Posted: Sat Jun 23, 2007 9:15 pm
by celect
thanks for the help guys

Posted: Sat Jun 23, 2007 10:36 pm
by Don Chambers
PHPaws wrote:Wouldn't that also align the calendar to the left?
To a very limited degree - the calendar uses inline styles unless those classes are specifically overidden in style.css. In fact, that is the better way to handle it because odds are that most sidebar output will look better left aligned than centered. In this example, only the date numbers would become left aligned. Those can be returned to center aligned by:

Code: Select all

.serendipity_calendar td{
  text-align:center;
}
PHPaws wrote:I've chosen to modify .serendipity_entry_body insead of .serendipity_entry because he only wants to style links within a post. Styling .serendipity_entry could have adverse effects on any link in this container.
I may have misinterpreted the original intent. It depends on what is, and is not, styled through a more specific class. The impact for this template is as follows:

.serendipity_entry - ALL links - including those in the title, body and footer will be styled this way UNLESS they have a more unique class that is, or can be, styled differently.

.serendipityEntryBody - only links within the body of an entry are styled.

.serendipity_entryFooter - the links such as "posted by.... at... Comments... trackbacks..."
Still, I have to agree with modifying the stylesheet directly. But not everybody is able or feeling up to do that. :)
If someone can install a plugin, insert lines of css into it, then they can certainly use a text editor to directly modify the existing css, and its a LOT more clean. Plus, it will expose them to the other classes and IDs that are also styled, which might make it possible for them to find something in the future that they want to change and/or learn from example by what is already there.

Posted: Sun Jun 24, 2007 7:09 pm
by celect
thanks don