Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 18th Dec 2012, 01:14 PM   #1
Warrior Member
 
Join Date: 2012
Posts: 14
Thanks: 5
Thanked 0 Times in 0 Posts
Default
How can I allow div to float outside the main container
Share on: 
fb share twitter share gplus share more share

I am working on WP using a template and I'm trying to get a button to float outside the main container. I went through some already posted questions here, but no luck.

I have tried with padding, margin, overflow, etc. The one thing that seems to work is by setting negative margin, but in that case the div is hidden by the main container.

Here's the HTML/PHP:
PHP Code:
<div class="purchase_options_meta clearfix">
                    <div class="purchase_options">
                        <?php if (function_exists('gb_deal_has_attributes') && gb_deal_has_attributes()): ?>
                        <div id="deal_attributes_wrap" class="section ">
                            <?php gb_add_to_cart_form() ?>
                        </div>
                        <?php else: ?>
                        <div class="buy_button gb_ff font_x_large">
                            <?php if ( gb_deal_availability() || !gb_is_deal_complete() ): ?>
                            <a href="<?php gb_add_to_cart_url(); ?>" class="button"><?php gb_e('Buy it!'); ?> <span><?php echo str_replace('.00','',gb_get_formatted_money(gb_get_price()))  ?></span></a>

                            <?php elseif ( gb_is_sold_out() ) : ?>
                            <a class="button"><?php gb_e('Sold Out!') ?></a>
                            <?php else : ?>
                            <a class="button"><?php gb_e('It&rsquo;s over!') ?></a>
                            <?php endif ?>
                        </div>
                        <?php endif ?>
                    </div>
And here's the CSS I'm using (it doesn't include the negative margin):

Code:
.purchase_options {
	position: relative;
	}
	
	.buy_button {
	position: absolute;
	background: url(http://topgreekgyms.fitnessforum.gr/wp-content/uploads/2012/12/Button.png) no-repeat center;
	color: white;
	height: 67px;
	width: 375px;
	left: -36px;
	z-index: 9999;
	}
	
	.button {
	background-color: transparent;
	color: #FFFFFF;
	}
		
	.button:hover {
	background-color: #ffffff;
	color: white;
	}
	
	.buy_button a {
	font-weight: bold;
	font-size: 29px;
	font-family: arial;
	padding: 12px;
	display: block;
	white-space: nowrap;
	position: relative;
	}
And here's a link to the page. My problem is with the top red button at the left.

I would greatly appreciate any help!
Kat
katindo is offline  
Unread 18th Dec 2012, 01:25 PM   #2
Full Stack Developer
 
Patrick's Avatar
 
Join Date: 2011
Location: Bangkok, Thailand
Posts: 1,142
Thanks: 56
Thanked 206 Times in 183 Posts
Default
Re: How can I allow div to float outside the main container
Share on: 
fb share twitter share gplus share more share

Where is the link to the page ?

Patrick is offline  
Unread 19th Dec 2012, 04:45 AM   #3
Warrior Member
 
Join Date: 2012
Posts: 14
Thanks: 5
Thanked 0 Times in 0 Posts
Post
Re: How can I allow div to float outside the main container
Share on: 
fb share twitter share gplus share more share

Originally Posted by schwarzes View Post

Where is the link to the page ?
Hello schwarzes!

Heres' the link to the page 40

There was a development after I posted the question. I changed the overflow of the main container from 'auto' to 'visible' and that brought the button on top, but now the container won't expand according to the content in it!
katindo is offline  
Unread 19th Dec 2012, 05:18 AM   #4
Full Stack Developer
 
Patrick's Avatar
 
Join Date: 2011
Location: Bangkok, Thailand
Posts: 1,142
Thanks: 56
Thanked 206 Times in 183 Posts
Default
Re: How can I allow div to float outside the main container
Share on: 
fb share twitter share gplus share more share

Originally Posted by katindo View Post

Hello schwarzes!

Heres' the link to the page 40

There was a development after I posted the question. I changed the overflow of the main container from 'auto' to 'visible' and that brought the button on top, but now the container won't expand according to the content in it!

Add this in your css file and that will be fixed...

Code:
#deal_single.clearfix:after {
    clear: both !important;
}

Patrick is offline  
Unread 19th Dec 2012, 05:38 AM   #5
Warrior Member
 
Join Date: 2012
Posts: 14
Thanks: 5
Thanked 0 Times in 0 Posts
Default
Re: How can I allow div to float outside the main container
Share on: 
fb share twitter share gplus share more share

Originally Posted by schwarzes View Post

Add this in your css file and that will be fixed...

Code:
#deal_single.clearfix:after {
    clear: both !important;
}
I really can't thank you enough! It was driving me crazy!
Have a great day!
katindo is offline  
Closed Thread


Bookmarks

Tags
container, div, float, main


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 01:15 PM.