Solved

CSS to align submit button next to select box

Posted on 2011-09-17
6
472 Views
Last Modified: 2012-05-12
I wish to align the select button "Save" next to the Select box.

So I have tried adding

#block-commerce-multicurrency-currency-selector {
      float: left;
      display: inline;
}

to the Style.css sheet
I am relatively new to CSS and, this code generated by Drupal, is making it just that much more complicated. I am really not sure which id, class to pick, the CSS syntax and whether float: left; display:inline; will do the trick.


Thanks for your help, Neil
<div id="block-commerce-multicurrency-currency-selector" class="block block-commerce-multicurrency">
<div class="content">
<form id="commerce-multicurrency-selector-form" accept-charset="UTF-8" method="post" action="/frontpage">
<div>
<div class="form-item form-type-select form-item-selected-currency">
<input id="edit-save-selected-currency" class="form-submit" type="submit" value="Save" name="op">
<input type="hidden" value="form-oLhqr1BOS5im9WCxwZo9ORErvuzBzQGA3--srrEMjGE" name="form_build_id">
<input type="hidden" value="5Z-mHEK7cLPnqD-0sNJfG0m93z5jxZN72O2ZUOx2frw" name="form_token">
<input type="hidden" value="commerce_multicurrency_selector_form" name="form_id">
</div>
</form>
</div>
</div>

Open in new window

0
Comment
Question by:offshorewindinwinter
  • 4
  • 2
6 Comments
 
LVL 12

Assisted Solution

by:junipllc
junipllc earned 250 total points
Comment Utility
Hey there, welcome to the CSS party. CSS with Drupal can be stressful enough to cause gray hair...that is, until you "get" what Drupal is trying to do ;) After that it's incredible what you can do.

That aside, I'm not seeing a select box in the code that Drupal generated (and you copied in here). However, if I put one in (see attached code that I dropped into a page), and the select box is in the same position, then you already have it. Or at least it's working here.

I'm also attaching a screenshot of what it looks like in my browsers. I tried both Chrome and Firefox on the Mac.

If you're still having issues with the CSS, do you have a live example that we can look at? I know that's iffy, but it really might be the best way to solve it.

Cheers,

Mike


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

<style>
#block-commerce-multicurrency-currency-selector {
      float: left;
      display: inline;
}

</style>

</head>

<body>
<div id="block-commerce-multicurrency-currency-selector" class="block block-commerce-multicurrency">
<div class="content">
<form id="commerce-multicurrency-selector-form" accept-charset="UTF-8" method="post" action="/frontpage">
<div>
<div class="form-item form-type-select form-item-selected-currency">
<select>
<option>Dollars</option>
<option>Euros</option>
<option>Yen</option>
<option>Pesos</option>
</select>
<input id="edit-save-selected-currency" class="form-submit" type="submit" value="Save" name="op">
<input type="hidden" value="form-oLhqr1BOS5im9WCxwZo9ORErvuzBzQGA3--srrEMjGE" name="form_build_id">
<input type="hidden" value="5Z-mHEK7cLPnqD-0sNJfG0m93z5jxZN72O2ZUOx2frw" name="form_token">
<input type="hidden" value="commerce_multicurrency_selector_form" name="form_id">
</div>
</form>
</div>
</div>

</body>
</html>

Open in new window

Screen-shot-2011-09-17-at-8.57.5.png
0
 

Author Comment

by:offshorewindinwinter
Comment Utility
Thank you junipllc .. of course your code worked but when I added it to style.css

and then another try

#block-commerce-multicurrency-currency-selector {
      width:200px;
      height:100px;
      float:left;
      display:inline;
}

nothing changed ?? What am I missing?

Actually I would like to get rid of the submit button all together and trigger the change in currency simply by changing the select box.

I have the question pending at http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27316501.html

Thank you, Neil



<div class="region region-sidebar-second">
<div id="block-commerce-multicurrency-currency-selector" class="block block-commerce-multicurrency">
<div class="content">
<form id="commerce-multicurrency-selector-form" accept-charset="UTF-8" method="post" action="/frontpage">
<div>
<div class="form-item form-type-select form-item-selected-currency">
<select id="edit-selected-currency" class="form-select" name="selected_currency">
<option value="CAD">CAD</option>
<option selected="selected" value="USD">USD</option>
</select>
</div>
<input id="edit-save-selected-currency" class="form-submit" type="submit" value="Save" name="op">
<input type="hidden" value="form-iblmsWtGwaH8jFzHiStq8QfY1TzvXYl5MhkvcuTvazY" name="form_build_id">
<input type="hidden" value="5Z-mHEK7cLPnqD-0sNJfG0m93z5jxZN72O2ZUOx2frw" name="form_token">
<input type="hidden" value="commerce_multicurrency_selector_form" name="form_id">
</div>
</form>
</div>
</div>
</di

Open in new window

0
 

Accepted Solution

by:
offshorewindinwinter earned 0 total points
Comment Utility
<div class="form-item form-type-select form-item-selected-currency"> was set to display:block

So this did the trick

#block-commerce-multicurrency-currency-selector {
float:left;
}
.form-item-selected-currency {
      display:inline;
}

Thanks again for your help (and it would great if you could help now get rid of the submit button altogether)

Cheers, Neil
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 12

Expert Comment

by:junipllc
Comment Utility
That one's easy, but then how would you submit the form? ;)

Try this:

#edit-save-selected-currency {
display: none;
}

or, if it works for your layout since it's better for SEO:


#edit-save-selected-currency {
margin-left: -9999px;
}

Cheers,

Mike (junipllc)
0
 

Author Comment

by:offshorewindinwinter
Comment Utility
I want to use the onchange event of the select box and javascript.

Please see the question I have pending at http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27316501.html

Thank you, Neil
0
 

Author Closing Comment

by:offshorewindinwinter
Comment Utility
Thanks for your help!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
In this article, we will look at our content management system as a whole, to get an idea of how we will start to manage these content items.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now