Welcome!

And don't forget to edit your signature & profile.

 

Icon

Statistics

  • Total posts 26844
  • Total topics 4877
  • Total members 6616
  • Our newest member
    Kamila

TOP POSTERS

Help with Floated Image

Designing the web. Work and development.
   

Help with Floated Image

Postby Preeminent » Sun Apr 12, 2009 10:42 pm

Ugh, I hate to even post this, because this should be something very simple. It just won't work for me though.
I have a div(welcomebox) that has it's background image specified within the html, not css. This is because I want to have a class(intro) specified to it for the purpose of jquery.
Within the div I have an H2 heading and a paragraph. Within this div I also want to add in a little X image that can be clicked-- again for the purpose of jquery. I have tried to add in this X image in the html and tried to floatRight it. Did not work. I have tried to give this X image it's own div and added it within the above mentioned div and gave it position:relative. Did not work. I also messed around with z-index . I just can't get it to work. I must be doing something wrong. Anyone have any ideas?
*****************************************************************

<div id="welcomebox">
<img src="welcomebox.png" alt="Online home." class="intro" />
<h2>Welcome to Preeminent Productions!</h2>
<p>;kua;asklgn;ayupeuranglaiuea[ne</p>

</div>
***********************************************************

#welcomebox {
height:130px;
width:402px;
padding-right:15px;
padding-bottom:15px;
float:right;
bottom:-435px;
right:70px;
position:relative;
}
Preeminent
Smashing <hr />
 
Posts: 51
Joined: Sun Feb 15, 2009 2:15 am
   

   

Re: Help with Floated Image

Postby HammHetfield » Sun Apr 12, 2009 11:46 pm

Code: Select all
#welcomebox img {
position : relative;
left:px to the left;
}


Replace "px to the left" by the number of pixels you want the X image to be moved to the right...
I'm french, so sometimes, my english can be bad, but I try to be undertandable, if I'm not, excuse me...
User avatar
HammHetfield
Smashing <table>
 
Posts: 36
Joined: Sun Apr 12, 2009 9:09 am
Location: France
   

   

Re: Help with Floated Image

Postby Preeminent » Mon Apr 13, 2009 9:39 pm

Thanks for your reply! I'm sorry, I didn't add in the second image within the div in my html.

There is also <img src="closebutton.png" class="button"/> along with the other image.
So by using the css that you posted, it effects both images. I only want the Closebutton image to be moved to the right. Is there a way to use both images, but only move the one? Can i make just the closebutton image float to the right?


<div id="welcomebox">
<img src="closebutton.png" class="button" />
<img src="welcomebox.png" alt="Online home." class="intro" />
<h2>Welcome to Preeminent Productions!</h2>
<p>;kua;asklgn;ayupeuranglaiuea[ne</p>

</div>
Preeminent
Smashing <hr />
 
Posts: 51
Joined: Sun Feb 15, 2009 2:15 am
   

   

Re: Help with Floated Image

Postby falkencreative » Mon Apr 13, 2009 10:05 pm

You could use Hamm's solution, just give the specific image you want to adjust a class name:

<img class="classname" src="" />

and then adjust the CSS to refer to that class name:

#welcomebox .classname { }
Benjamin Falk | student : designer : developer
http://www.falkencreative.com | http://www.twitter.com/falkencreative
User avatar
falkencreative
Smashing <li>
 
Posts: 269
Joined: Sun Jan 18, 2009 7:25 pm
Location: Chico, CA
   

   

Re: Help with Floated Image

Postby HammHetfield » Tue Apr 14, 2009 3:38 am

Yes the code I gave you move all images, if there is only one image that you wan't to move, give it a class attribute and use my code replacing "img" by the class of the image as Falken wrote ;)
I'm french, so sometimes, my english can be bad, but I try to be undertandable, if I'm not, excuse me...
User avatar
HammHetfield
Smashing <table>
 
Posts: 36
Joined: Sun Apr 12, 2009 9:09 am
Location: France
   

   

Re: Help with Floated Image

Postby breastfed » Tue Apr 14, 2009 2:15 pm

Please try this here:

<div id="welcomebox" style="width: 440px;">
<img src="welcomebox.png" alt="Online home." style="float: left; width: 10px;"/>
<h2 style="float: left; width: 400px; margin: 0; margin-left: 10px; ">Welcome to Preeminent Productions!</h2>
<img src="closebutton.png" class="button" style="float: right; width: 10px;" />
<p style="clear: both;">;kua;asklgn;ayupeuranglaiuea[ne</p>

</div>

The 440px and 400px ar just Width for the Example.
"A day without a Table is a good day."
User avatar
breastfed
Smashing <table>
 
Posts: 46
Joined: Tue Apr 07, 2009 1:17 pm
Location: Dülmen, Germany
   


Return to Web Design



Who is online

Users browsing this forum: No registered users and 1 guest