CSS - Target Only Images Within Paragraphs
Hi all, I'm trying to use CSS to apply style to ONLY images that are within paragraphs on my site.
Code: <p> <img ... /> </p> In the past, some time ago, I thought I learned that "p img {...}" would accomplish what I'm trying to to. However, it applies the style to all images, not just images within paragraphs... Any one know any other methods? I have a couple hundred images already coded in, so just simply applying a class to the previous images isn't something I'd like to do. Thanks much, dbeg. Similar TutorialsHello, I have a table formatted by CSS within which there are two styles of text, headers and content. I have the content formatted using a class (conftabledetail), with the statement: .conftabledetail {font-size:10px;} I did that to make the content more compact and distinguishable from the headers. I would like to force a space between the paragraphs of content without using a <br> tag. I read that there is an "adjacent selector" which can be used to locate adjacent tags and apply a style, for example p + p {margin-top:1em;}, which would put a 1em space between adjacent paragraphs. Apparently this selector does not work when used against a subclass, because I can't get this statement to work: p + p.conftabledetail {margin-top:1em;} I CAN get this statement to work: p.conftabledetail {margin-top:1em;} But that's not what I want to do. Anyone have any ideas as to what I need to change or do differently? It would also be nice to do this with a <div> tag so I don't have to repeat the class identifier on every <p> tag... Thanks, Chris I'm experimenting using css, on the page http://www.philmorris.biz/view.php?id=3278941167 The problem I have is the way that each line on the description has its own highlight- something that I've only experienced with css One thing I've noticed is that each line of the description is it's own paragraph, however since the description is pulled straight from eBay, there's not much I can do about that. Are there any obvious things I'm not thinking of? Thanks I have a bunch of text with nice formatting using paragraphs and I want to have a spacing between the paragraphs. I could easily do that by: Code: p { margin-bottom: 25px; } But that will make it so the last paragraph to also have a margin like that, how can I make it so that the last paragraph have a bottom margin of 0? Just the last one in that bunch of text. Now that, this is dynamic content generated by WordPress. WordPress text is place using paragraphs but the last paragraph on each post also has a margin that shouldn't be there, or my current design of course. Is there a way around this? This site is entirely CSS built and is database driven so it is completely dependent on classes and Id's. I have a conflict with <H5> in this page/site template I'm trying to edit. H5 is used for the title in the header and needs to be white. As you can see by the example of the my news section it looks just as I want it (H5 is the bigger bolder text that starts each paragraph) MyNews.jpg Code: <div class="bodyNews"> <h4>My News</h4> <h6> <h5>News 1</h5> Content ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. </h6> <h6> <h5>News 2</h5> Content ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. </h6> <h6> <h5>News 3</h5> Content ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. </h6> </div> And here's the CSS: Code: div.myNews {} h4 { font: 15px Georgia,serif; font-weight: normal; color: #6b3616; text-transform: uppercase; display: block; margin: 25px 0 2px 0; } h5 { font: 14px Georgia,serif; font-weight: normal; color: #6b3616; margin-right: 4px; display: inline; } h6 { font: 11px/14px Verdana,sans-serif; color: #3d412d; margin: 10px 4px 2px 0; } So the problem is the H5 though it looks fine in this news part it messes with the header H5 and I can't change the class there... There must be another way to do this... Can anyone offer an alternative? See the site he Template M What is the correct way to remove the space between paragraphs? I have p { margin-top: -12px; } but IE/Win appears to be clipping the top of the topmost paragraph containers. What is the most compatible way to do this? i have a div that has a background img. when i have p's within this div the background img only shows up if theres a line of text there. i specified the height: 277px to fix this (if theres a better way, pls let me know). and tried to put overflow:visible within p's but its still clipping. any ideas? containing div: Code: #content .col { width: 303px; height: 277px; background: url(../images/one_third_box_top.png) no-repeat; float: left; } p: Code: #content p, ul { padding: 0 25px 0 30px; line-height: 1.5em; overflow: visible; } edit: this problem is in mozilla, but not in IE... weird. theres also one minor thing on a totally different subject. paths.. my paths a Code: /pub /css main.css /images foo.jpg foo2.jpg index.html obviously i have a link to the main.css in the index file but when i try to use url(images/foo.jpg), foo.jpg wont load? the path looks right unless im missing something... instead i have to url(../images/foo.jpg) for it to work... i always thought the '../' meant parent directory of the file (which is index.html since its linked from it)... right? thanks in advance. *insert newbie stuff here* got something i want to do in css that i dont even know if its possible. last time i did was in php and forgot how.lol. ok i have a side box div that i want to put links to images in and i want the images to load in another div box on the same page. so it opens the photo, just in a certain place on the page (in div id or position:absolute) is this possible in anyway? On this page (FAQs.html) I'm using css Code: Original - css Code *:target {background-color: #ffff00;} *:target {background-color: #ffff00;} to get the yellow highlight on the corresponding Q/A when you click a question. Works great in FF2, Opera, Chrome, Seamonkey, and Safari. But of course IE7 has to be a problem. It doesn't work in IE7. (Don't know about IE6, don't have that to test it on.) I've been Googling for a way to implement this effect in IE but haven't found anything. Any ideas? Thanks, Ez P.S - the text on the FAQs page is just dummy-text until i get the real content to insert. Hey, I've run into a problem where I though i knew how to do it an easy way but it only worked for about 5 minutes. Here is what I have. All of my pages have the same navigation from an external PHP file. The style is saved in the main.css stylesheet. When you select a link it gets a background image. I thought that I could save my self having to edit every page for IE by doing this in the main.css stylesheet Code: * html>#navwhatever{ /*set to gif iamge instead of PNG image*/ background-image:url('image/splash_legion.gif'); } This doesn't work. It still uses the PNG images. I'd realy like not to have to edit every page to fix my site for IE, any suggestions would be great. Thanks for reading I'm using frames and I want all my anchors to launch in a separate frame. Right now I'm doing: Code: <a href="http://example.com" target="MAIN">example</a> Can I put something in my stylesheet that will automatically launch all links in the "MAIN" frame? Thanks. Hi! Should I do this? p { margin-top: 2em; margin-bottom: 2em; } or this: p { margin-bottom: 2em; } Same question for headers (h1, h2, etc) Thanks! On my site I'm trying to have a messageboard within a CSS Div. While the phpBB/database is on a remote server, I think it would be easier to have it appear within the main div. Is there a way to do this? If not, I'm just going to make the messageboard appear in a new window. Thanks... I'm struggling to target some headings in ie 6. They need more padding on the top as they look slightly chopped. www.efficient-heat.net/services The headings are Power Flushing and Condensing Boilers I've had a look at them in internet explorer developer toolbar and i'm seeing several paddings being applied. This suggests a conflict in the cascade. I've given the styling for the Power flushing header rule !important but that doesn't work. The headings look ok in ie 7 and ff3 How do I target these titles for styling in ie6? Hi, How can I target the last element of a list. The number of items in the list is not always four. Thanks Code: <div id="mainmenu"> <div class="mod_menu"> <ul> <li>first</li> <li>second</li> <li>third</li> <li>last</li> </ul> </div> </div> Hi all, I am developing a website and kiosk display hardware. I want to target the kiosk display using a specific stylesheet. What is the best way? @media display and height:??px and width ??px or using @media ???kiosk??? etc. What other specifics can I target to define which style sheet is used? Thanks for any help. Dale. is there a way to set the target of a class of links using css? the html : target="_blank" is not xhtml compliant. Is there an equivalent to the target attribute in XHTML strict for anchor tags? new at this - learning the rope. baby steps. is there a way to set a link target to open the link in another div on the page? Hi! How do I open a link in a new window in XHTML strict? (knowing that target="_blank" forbidden). Thank you I just wondered if I can apply a style (background image) using css only if my href has a target assigned to it and disregard the style if target does not exist on the link I don't want to apply a class to some <a> and not to others I just wondered if I can use the css to recognise the target attribute |