Assigning class
millions - January 23, 2009 - 17:48
| Project: | Block Class |
| Version: | 5.x-1.1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Hello, I'm pretty new to CSS and I'm wondering if there's a way to define a CSS for only part of the contents of the block. i.e. I'd like to center an image but not the text of the block. I've used Block Class to center the content and not the title of the block so far, but I'd like to somehow distinguish between the text and the image. Is this possible?
Thanks for the help!

#1
Xoso: Your question doesn't really relate to the Block Class module, but since I understand how complicated CSS can be, I'll try to send you in the right direction.
Anything that stands alone or is followed by a period or hash mark is an "element" (
div,img, etc.). Anything preceded by a period is a "class" (.blockabove).To select an element within an element, you simply put them all together in a line:
div img {margin: 10px;
}
This means "any image within a div should have a margin of 10 pixels."
To select an element within a particular class of block, add a
.classto the outer element:div.foo img {margin: 10px;
}
This means "any image within a div of class 'foo' should have a margin of 10 pixels."
To select particular elements within a block -- blocks usually have class "block" assigned to one of their outer divs -- you'd do something like this:
div.block img {margin: 10px;
}
I hope this gets you on the right track. Please refer to the many basic CSS guides found online for for help.
#2
Thanks for taking the time to give me some pointers, I appreciate it!