PDA

View Full Version : CSS: How to address a div within a div



gorilla1
Oct 24th, 2008, 05:03 PM
I am using the rsspausescroller script from dynamic drive. It is a script that enables placement of an rss feed on an html page. An instance can be created with this line of javascript:
new rsspausescroller("mysite, "pscroller2", "rssclass", 3000, "_new")

In that line, 'pscroller2' refers to the div where the feed will display. The sample css looks like so:
pscroller2{
width: 155px;
height: 140px;
border: 1px solid white;
padding: 5px;
}

All of this works fine. However, I would like to place the pscroller2 div within another div, let's call it column-b.
#column-b {
width: 410px;
float: left;
}

How do I accomplish this so that I can address the pscroller2 div within column-b?

G

abduraooft
Oct 24th, 2008, 05:21 PM
If pscroller2 is a class then

#column-b .pscroller2{
} Or if it's an id, then

#column-b #pscroller2{
}
(Assuming column-b is an id)

gorilla1
Oct 24th, 2008, 08:31 PM
Thank you very much. Yes, it is a div -- I left off the #. It should have been:

#pscroller2{
width: 155px;
height: 140px;
border: 1px solid white;
padding: 5px;
}

So iI tried coding it like so:
#column-b #pscroller2{
But if I then use pscroller2 in the line of javscript like this:
new rsspausescroller("cshj", "pscroller2", "rssclass", 3000, "_new")
the scroller appears at top of page rather than in column-b. Below is
what the javascript function looks like:

function rsspausescroller(RSS_id, divId, divClass, delay, linktarget, logicswitch){
this.tickerid=divId //ID of ticker div to display information
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1"><span style="position: absolute">Initializing RSS scroller...</span></div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2"></div></div>')

G