Shiba

Adventures in WordPress

  • Home
  • Dog
  • Art
  • Contact
  • WordPress Articles
    • WP Plugins
    • WP Programming
    • WP Admin Panels
    • WP Theme Design
    • WP How-To
    • WP Theme Images
You are here: Home / WordPress Design / How to Make Poll Daddy Objects Mobile Responsive

How to Make Poll Daddy Objects Mobile Responsive

by ShibaShake 3 Comments

Currently, the standard Poll Daddy objects that I use are fixed width and not mobile responsive. Here are some simple CSS styles that I use to make Poll Daddy objects responsive to small devices.

1. Scale poll object to fit the screen.

The first step is to add some styles to scale my Poll Daddy objects so that they expand to fit the screen. I do this when the browser width hits 400 pixels.

@media only screen and (max-width: 400px) {
	.PDS_Poll { width: 100%; overflow:hidden; }
	.PDS_Poll .pds-box { width: 100% !important; }
	.PDS_Poll .pds-input-label { width: 100% !important; }
}

Note that pds-box and pds-input-label have fixed widths assigned by default, so we need to override that with the !important tag.

I have added an overflow:hidden property to PDS_Poll, which is the main container class, to further ensure that my poll objects never exceed a smaller screen width.

Screen-shot of non-responsive Poll Daddy object.
Before – Non-responsive Poll Daddy object. Note that the text and border to the right gets cropped because of the smaller browser width.
Screen-shot of mobile width responsive Poll Daddy object.
After – Width responsive Poll Daddy object. The poll now changes size according to the width of the browser.

2. Make text float to the right of radio buttons.

However, in the mobile responsive screen-shot above, the text has been pushed down to the line below the radio buttons. Instead, we want our poll text to float to the right of the radio buttons. We achieve this by adding some space to the pds-input-label class, to accommodate for the radio button width, which is 25 pixels wide.

@media only screen and (max-width: 400px) {
	.PDS_Poll { width: 100%; overflow:hidden; }
	.PDS_Poll .pds-box { width: 100% !important; }
	.PDS_Poll .pds-input-label { width: 100% !important; margin-left: -25px; padding-left: 25px; }
}

Screen-shot of mobile responsive Poll Daddy object, where text floats properly to the right of radio buttons.
Poll text now floats to the right of radio buttons.

padding-left: 25px; – Creates space to the left of our poll text so that we get the right width of text. This assumes that we are using border-box for the box-sizing property.

margin-left: -25px; – Places the padding space over the radio button so that our poll text follows properly right after it.

3. Save space by removing borders and padding.

Finally, space is at a premium for small screen devices, so we may want to utilize what we have as effectively as possible. For example, we may want to remove the border, background, and padding of our poll object so that we have more space for our poll text.

@media only screen and (max-width: 400px) {
	.PDS_Poll { width: 100%; overflow:hidden; }
	.PDS_Poll .pds-box-outer { padding: 0; } 
	.PDS_Poll .pds-box { width: 100% !important; border:none !important; background: none !important; }
	.PDS_Poll .pds-input-label { width: 100% !important; margin-left: -25px; padding-left: 25px; }
}}

Here is the final result.

Final result of mobile responsive Poll Daddy object.
Final result of mobile responsive styles for Poll Daddy object.

If we encapsulate the Poll Daddy object within another div then we will also need to style that div accordingly. For example, I usually float my polls to the right, with a left margin to separate it from my text. Therefore, I need to remove these for small screens.

Example mobile responsive Poll Daddy object.
Poll Daddy object floated to the right.

		@media only screen and (max-width: 400px) {
			.div-poll { float: none; margin: 0; }
		}

Internet Explorer

Screen-shot of Poll Daddy object in Internet Explorer 10.
Slight square border around radio buttons in Internet Explorer 10.

Finally, I have also noticed that in Internet Explorer 10, my Poll Daddy objects appear with a border around the radio buttons (see right).

To remove this border, I add the following CSS styles –

.PDS_Poll input[type="radio"] {
	background-color: transparent !important;  
	border: 0; 
	box-shadow: none; 
}

Here is the final result –

Screen-shot of Poll Daddy object with borders removed around radio buttons, in Internet Explorer 10.
Removed border around radio buttons in Internet Explorer 10.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comments

  1. Nick says

    December 15, 2017 at 5:04 am

    Thanks for this, took a while for me to find your post but it’s the only answer online!

    Reply
  2. Peter says

    February 6, 2014 at 7:48 am

    Does this still works on wordpress 3.8.1??
    Thanks

    Reply
    • ShibaShake says

      February 11, 2014 at 2:01 pm

      It works for my sites which are on 3.8.1.

      Reply

Recent Posts

  • Screenshot of an example article in code view of a modified Gutenberg editor.How to Harness the Power of WordPress Gutenberg Blocks and Combine It with Legacy Free-Form Text
  • Screenshot of the Success, WordPress has been installed page.Migrating Your WordPress Website to Amazon EC2 (AWS)
  • Screenshot of WinSCP for creating a SFTP configuration.How to Set-Up SFTP on Amazon EC2 (AWS)
  • WordPress Gutenberg code view screenshot of this article.How to Prevent Gutenberg Autop from Messing Up Your Code, Shortcodes, and Scripts
  • Screenshot of the Success, WordPress has been installed page.How to Create a WordPress Website on Amazon EC2 (AWS)

Recent Comments

  • Create Pop-up Windows in Your WordPress Blog with Thickbox (57)
    • Jim Camomile
      - I have used this tutorial several times and it is one of the few simple and effective ways to add popups with dynamic content, ...
  • How to Add Admin Columns in WordPress (7)
    • Andy Globe
      - Hi Friends, I am facing two problem in WordPress admin1. Load custom CSS for wp-admin on user-role base (editor) 2. ...
  • Example blog front-page using excerpts and the Shiba Theme.Optimize Your WordPress Plugins with Tags (5)
    • DF
      - thanks, i went the other way and added a filter if pages I wanted.
  • WordPress Search Widget – How to Style It (57)
    • Nelson
      - Tanks master - Fine
  • Update custom inputs with the proper data using Javascript.Expand the WordPress Quick Edit Menu (59)
    • Mike G
      - This is exactly what is happening to me. It is updating the value in the database and in the column, but I have to refresh ...

Copyright © 2022 · Genesis Skins by ShibaShake · Terms of Service · Privacy Policy ·