Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Specific input style for a specific div

Featured Replies

Hey guys,

 

I am having a go at styling a form.... I honestly hate forms but going for it anyway.

 

I am having issues styling the submit button by itself as it is taking on the generic input style.

 

The layout goes as follows (I have stripped it down to the basic bits I am talking about):-

 

<div id="two-column">

Main form elements here

<div id="contact-button" class="fourcol last"><input type="submit" value="Send" class="wpcf7-form-control wpcf7-submit pink-button" /></div>

</div>

 

So when this loads it brings up the generic input styling of:-

 

input {padding: 9px; border: solid 1px #E5E5E5; outline: 0; background: #FFFFFF url('bg_form.png') left top repeat-x; background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #EEEEEE), to(#FFFFFF)); background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px); box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; -moz-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; -webkit-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; margin-bottom:20px;}

but it also brings up the custom style I added in:-

 

input .pink-button {background-color:#d1d1d1; text-indent:0px; display:inline-block; color:#FFF !important; font-family:arial; font-size:15px !important; font-style:normal; height:30px; line-height:30px; width:110px; text-decoration:none; text-align:center; margin-top:20px;}
input .pink-button:hover {background-color:#ed1e79; -webkit-transition-duration: 1s; -moz-transition-duration: 1s; -ms-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s; color:#FFF !important;}
input .pink-button:active {position:relative; top:1px;}

Is there a way to stop both styles from running and just have one?

 

Thanks in advance :-)

Make sure the generic input style is either erased or commented-out, then just remove 'input' from your custom styling, like so:

.pink-button {background-color:#d1d1d1; text-indent:0px; display:inline-block; color:#FFF !important; font-family:arial; font-size:15px !important; font-style:normal; height:30px; line-height:30px; width:110px; text-decoration:none; text-align:center; margin-top:20px;}

.pink-button:hover {background-color:#ed1e79; -webkit-transition-duration: 1s; -moz-transition-duration: 1s; -ms-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s; color:#FFF !important;}

.pink-button:active {position:relative; top:1px;}

If you want all submit buttons on your site (if there are multiples) to share this custom styling, then just add 'pink-button' as the class to each one. Keeping 'input .pink-button' would mean that it would style all input buttons as well as adding in the custom styling for pink-button.

Have you got a space between input and .pinkbutton? I'm not sure that works. Try input.pinkbutton without a space in the css and see if that works because it should override any similar styles in input but will still leave any that are in the input style unless you repeat them in input.pinkbutton with the styles that you want.

  • Author

Hi Wickham,

 

Thanks for your response. It didn't work either the button just went funky. I think I am just going to pull all the code out and start from fresh as I had two different form styles.

 

I think starting again would probably be the best thing.

 

Thanks guys

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.