Jump to content

Can you center a DIV on mobile, that is Float Right?


simona6

Recommended Posts

We have two DIVs created in WP Bakery.

Left and right.

On a phone I want to change the width of the right DIV, so it is 85% or so, but centre it, so there is the equal space left and right.  Since it is Float: Right, I can't do that.  Even wtih a Margin Left/Right auto, it just nudges to the left.

How do I override it so on a phone, it snaps to the middle, wtih 85% width?

Thanks

Link to comment
Share on other sites

Use media queries to create rules based on screen size or browser device as requinix suggested. Though admittedly you may have some work ahead of you as WPBakery (as far as I recall - thankfully it's been a while since I've had to deal with its output) has a tendency to overdo it with the built in CSS.

Link to comment
Share on other sites

I love WPB.... 

I think the answer is that you have to disable the Float on BOTH/ALL the Divs in the row, before you can then centre one.  As centering one, when it is Float.. just  doesn't work.

I'm familiar of course with Media Queries etc.  Thanks.  But yes I think you have to do BOTH/ALL divs to get the result.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.