It's all in the title I guess.
I'm trying to get an image to float left of a heading so the text wraps around the image. However, when i add the image, the heading just drops below. Float left doesn't work.
I'm guessing it has something to do with H tags being block elements.
Any help would be appreciated.
Thanks
Page 1 of 1
Float image to the side of a H tag Heading keeps dropping below the image
#2
Posted 09 April 2009 - 08:35 PM
Have you tried setting the heading to display inline? i.e in your css adding 'display: inline' to the heading property. Or alternatively floating your heading to the right?
#3
Posted 09 April 2009 - 10:24 PM
thanks for the reply.
yes that worked perfectly, thankyou! one problem though, i have this style:
I understand that this will apply to all the H2 tags within the main-content-2 div. I now need to create a new style exactly the same as this but with 'display:inline'. My problem is how would i name this rule.
for example
I know this isnt correct and would like to know how to create an identical style as some pages will use the original style and some pages will need to have the modified style with the display:inline.
Any help would be appreciated and thankyou to 'clearcutdesignz' for the remedy.
regards
yes that worked perfectly, thankyou! one problem though, i have this style:
Quote
.main-content-2 h2 {clear:both; margin:1.0em 0 0.5em 0; font-family:"trebuchet ms",arial,sans-serif; color:rgb(80,80,80); font-weight:normal; font-size:170%;}
I understand that this will apply to all the H2 tags within the main-content-2 div. I now need to create a new style exactly the same as this but with 'display:inline'. My problem is how would i name this rule.
for example
Quote
.main-content-2 h2 headingwrapsimage {clear:both; margin:1.0em 0 0.5em 0; font-family:"trebuchet ms",arial,sans-serif; color:rgb(80,80,80); font-weight:normal; font-size:170%; display:inline}
I know this isnt correct and would like to know how to create an identical style as some pages will use the original style and some pages will need to have the modified style with the display:inline.
Any help would be appreciated and thankyou to 'clearcutdesignz' for the remedy.
regards
#4
Posted 09 April 2009 - 10:44 PM
EDIT: Sorry, read it wrong. Read correct example below:
You can actually add 'display: inline' into your current .main-content-2 h2 class and have it only show on certain pages by giving
your pages a unique body ID. E.g. in the HTML of your homepage, where the body tag is located, if you changed it so it read You could then target this page separately in your CSS by adding something like this in your stylesheet:
As you can see, because we've given the homepage it's own unique body ID, we can add this before the h2 class and therefore have it only show on the homepage. Here's an example of doing the same thing, but having it affect a few specific pages:
Just remember you'll need to give each page a body ID for it to work.
You can actually add 'display: inline' into your current .main-content-2 h2 class and have it only show on certain pages by giving
your pages a unique body ID. E.g. in the HTML of your homepage, where the body tag is located, if you changed it so it read
Quote
<body id="home">
Quote
#home .main-content-2 h2 headingwrapsimage {clear:both; margin:1.0em 0 0.5em 0; font-family:"trebuchet ms",arial,sans-serif; color:rgb(80,80,80); font-weight:normal; font-size:170%; display:inline}
As you can see, because we've given the homepage it's own unique body ID, we can add this before the h2 class and therefore have it only show on the homepage. Here's an example of doing the same thing, but having it affect a few specific pages:
Quote
#home, #about, #contact .main-content-2 h2 headingwrapsimage {clear:both; margin:1.0em 0 0.5em 0; font-family:"trebuchet ms",arial,sans-serif; color:rgb(80,80,80); font-weight:normal; font-size:170%; display:inline}
Just remember you'll need to give each page a body ID for it to work.
#5
Posted 09 April 2009 - 10:47 PM
You could either place a class on the body of the pages where you want the h2 to display inline example:
or on the individual h2 tags
EDIT If the above rules were below the existing rules you would only need to specify the display:inline;
body.whatever .main-content-2 h2 {clear:both; margin:1.0em 0 0.5em 0; font-family:"trebuchet ms",arial,sans-serif; color:rgb(80,80,80); font-weight:normal; font-size:170%; display:inline;}or on the individual h2 tags
.main-content-2 h2.whatever {clear:both; margin:1.0em 0 0.5em 0; font-family:"trebuchet ms",arial,sans-serif; color:rgb(80,80,80); font-weight:normal; font-size:170%; display:inline;}EDIT If the above rules were below the existing rules you would only need to specify the display:inline;
body.whatever .main-content-2 h2 {display:inline;} or.main-content-2 h2.whatever {display:inline;}
#6
Posted 09 April 2009 - 10:53 PM
thanks for the replies.
yes that would work!
i think i was thinking too much into it and creating a simple class to display stuff inline would be best.
thankyou for the advice!
yes that would work!
i think i was thinking too much into it and creating a simple class to display stuff inline would be best.
thankyou for the advice!
#7
Posted 10 April 2009 - 12:31 AM
I had a friend looking for the exact same information, thanks for this guys
Share this topic:
Page 1 of 1
Help

















