Custom Dotnetnuke (DNN) Skin Design

DNN site logo rollover effect

Location: DotNetNuke
 

I recently added a rollover effect to my site logo (if you rollover the rhoek.blog logo at the top you should see what I mean), and here's how it's done.

Overview.
The effect is created by using a transparent image for the physical logo uploaded to DNN and then using CSS to add a background of the logo image. This background contains both states of the rollover, the normal view and the rollover effect, which is then re-positioned using the a:hover pseudo-class, to create a rollover.

Step 1. Create the logo background graphic.

background image

Using photoshop, or whichever graphics package you use for creating artwork, design and layout 2 versions of your logo,1 for each of the 2 states. The key to remember here is that only half of the image will show at any one time, so make sure that the image is twice the height of the logo you use on your site, also make sure that each state is centered within its half so they line up when the effect is complete.

Image Sizes:
For the example shown my physical logo size is 225px x 78px and the background image size is 225px x 156px.

Note: If the two states don't line up you will notice a jump when the rollover occurs, if this is the case you'll need to move the logo in the artwork and re-upload the graphic used as a background.

Step 2. Upload the transparent logo.
Create a transparent gif the same size as your site logo (in this case 225px x 78px).

Through the site settings in the admin menu upload this image and set it as the site logo.

Step 3. Pointing to the logo image within the CSS.
The method for pointing the css to the image is known as targeting and to do this we can either apply a css class within the skin, surrounding your [LOGO] token, or add this as a css class to the XML file. In this example I've previously set the skin to have a css class so we'll use that. I'll explain at the end how to add a css class to the XML.

Within the HTML at the time of writing I have given the table cell containing the logo an id of "Logo".

To target the logo image you would tell the css to look within the "Logo" table cell for an anchor link containing an image.

td#Logo a img

Note: If you decide to use a class as opposed to an id replace the "#" with a "."

Step 3. Upload the background image.
Before we apply any css to the logo we'll need to upload and determine the url for the image. Use the DNN file manager or an FTP client to upload the image, then using your browser navigate to it. In this example, at the time of writing, the logo is in the root level of the server, so I can navigate to it through http://www.rhoek.com/portals/0/rhoek-logo-bground.gif. In the css I'll be referencing this relatively so I'll use /portals/0/rhoek-logo-bground.gif although an absolute path, as above, could be used.

Step 3. Creating the CSS.
When you are creating additional CSS for your dotnetnuke site, this can be added through the stylesheet editor in the site settings of the admin dropdown.

Within the css you'll need to determine 2 states to apply to the linking image background, one for it's general appearance and another for the rollover.

General

td#Logo a img{
background:url(/portals/0/rhoek-logo-bground.gif) scroll no-repeat top;
width:225px;
height:78px;
}

You can see here that we have applied the image for the logo as a background, not repeated it, and positioned the image to the top. As the physical image is transparent, this background shows through. We've also added a width and height because these aren't specified in the actual HTML img tag, and it's best practice to have these present.

Rollover

td#Logo a:hover img{
background:url(/portals/0/rhoek-logo-bground.gif) scroll no-repeat bottom;
width:225px;
height:78px;
}

Here we have changes the position of the background so it is positioned bottom. It is this change of position which creates the rollover effect.

Additioanl Information.

Adding css class to [LOGO] in skin XML file.
To specify a css class for the logo within the xml file, add a CssClass node to the token within which you can specify a CSS class name.

<Object>
<Token>[LOGO]</Token>
<Settings>
<Setting>
<Name>CssClass</Name>
<Value>LogoCss</Value>
</Setting>
</Settings>
</Object>

Image flicker in IE6.
An issue which occurs in Internet Explorer 6 is that it reloads background images if you change their position in the CSS for the rollover. This site shows you how to overcome this issue - http://www.mister-pixel.com/#Content__state=is_that_simple

Re: DNN site logo rollover effect
By DL on 3/28/2008 1:55 PM
very nice.....this site is still incomplete?
Re: DNN site logo rollover effect
By host on 3/28/2008 2:00 PM
DL, thanks for the comment. The site isn't as much incomplete, more a constant work in progress. The site logo rollover was from the old design, however the new design uses the same technique. Everything about DNN is forever developing (upgrades in framework, new blog module that kind of thing), so the same applies to the design and content of rhoek.com. Additional commitments and new template skin designs usually take precidence over this site, however I like to think that it does move on gradually although slower than I'd like.
Re: DNN site logo rollover effect
By Hope on 4/23/2008 8:01 AM
Thank you for the rolloever effect but I'm looking for something more basic. How did you make the [LOGO] token a link to your home page. I've created it in my html file but I have to update the skin everytime I move it from testing to production in my skins. I know that I can select a logo from within DNN but it doesn't make it a link. Can you help?
Re: DNN site logo rollover effect
By host on 4/23/2008 8:13 AM
Hope - If you are using the skin tokens in HTML, XML, and CSS based skin packs which you are zipping together and installing as a skin upload, the [LOGO] token should be replaced with the logo specified in the admin site settings when the files are parsed. If this isn't happening for your skin files please feel free to email me the skin pack you're working on and I'll have a quick look over it to see if there's anything obvious.
Your name:
Title:
Comment:
Add Comment    Cancel  

 

 

Rhoek.com's design blog focuses on web design and dotnetnuke skin design.

We've been designing and developing websites and custom/template dotnetnuke skins since 2003 and have experience in X/HTML, CSS, javascript, DNN skinning, XML, XSLT, accessibility, usability, email design and building, and Search Engine Optimisation.

Login
Sunday, March 14, 2010