How position a Multi-currency drop-down in the Supply theme - css

I'm having problems positioning the 'Multi-currency form' in the 'Supply' theme.
I've done it before in other themes without trouble, but this time I can't see why it's positioning the drop-down on the left of the container - we need it positioned on the right.
This is how it looks:
This is the relevant portion of the code:
I've tried adding all/many of the justify-items: end justify-contents:end options, but I'm obviously missing something critical/simple;?
============================some time later==================================
Well I was missing:
.shopify-currency-form {
display:inline-block;
}
But even so, had problems moving it to the right position responsively.
By trial&error I've got this far, but I don't like having to switch to absolute!!
/* added Multi-currency form */
.shopify-currency-form {
margin-bottom:0;
display:inline-block;
}
select[name=currency] {
width:100px;
height: 43px; /* same as cart button */
margin-bottom:2px;
}
#media screen and ( max-width:768px ) { /* move form to bottom right of header */
.shopify-currency-form {
position: relative;
bottom: -16px;
float: right;
}
}
#media screen and ( max-width:480px ) { /* move form up to top right of header */
.shopify-currency-form {
position: absolute;
float: right;
top: 53px;
right: 5px;
}
}
Any improvement much appreciated.

After checking your site the only thing you need to do is wrap you forms in a div. Put the currency dropdown form at after the search form. See below code.
<div class="wrap">
<form action="/search" method="get" class="search-bar" role="search">
<input type="hidden" name="type" value="product">
<input type="search" name="q" value="" placeholder="Search all products..." aria-label="Search all products...">
<button type="submit" class="search-bar--submit icon-fallback-text">
<span class="icon icon-search" aria-hidden="true"></span>
<span class="fallback-text">Search</span>
</button>
</form>
<form method="post" action="/cart/update" id="currency_form" accept-charset="UTF-8" class="shopify-currency-form" enctype="multipart/form-data">
<input type="hidden" name="form_type" value="currency"><input type="hidden" name="utf8" value="✓"><input type="hidden" name="return_to" value="/">
<select name="currency">
<option value="CAD">CAD $</option>
<option value="EUR">EUR €</option>
<option value="GBP" selected="selected">GBP £</option>
<option value="USD">USD $</option>
</select>
</form>
</div>

Related

bootstrap icon for username and password

I am designing login page. Here I am adding icons for username and password, when I add icons along with icons someother icons also adding how to resolve this . Here is my code.
<div class="left-inner-addon ">
<i class="icon-user"></i>
<input type="text" placeholder="User Name" name='j_username' >
</div></div>
and css is as follow,
<style type="text/css">
.left-inner-addon {
position: relative;
}
.left-inner-addon input {
padding-left: 30px;
}
.left-inner-addon i {
position: absolute;
padding: 10px 12px;
pointer-events: none;
}
</style>
and I dont have reputation to post pic of the login form .
I got an idea of what you are facing, according to the current standards of Twitter Bootstrap, you just have to use the following code to achieve what you want. I had tested it on live server and it is working fine.
Just replace your HTML Code by the following code :
<div class="input-group">
<span class="input-group-addon glyphicon glyphicon-user"></span>
<input type="text" class="form-control" placeholder="User Name" name='j_username'>
</div>
I hope this help.
I am writing a new answer for what you asked. Follow this code. This will definitely help.
Here's the HTML for the text box:
<div class="input-group">
<input type="text" placeholder="User Name" name='j_username' id="funkystyling" />
</div>
Here's the CSS for the image on the left:
#funkystyling {
background: white url(/path to icon.png) left no-repeat;
padding-left: 17px;
}
And here's the CSS for the image on the right:
#funkystyling {
background: white url(/path to icon.png) right no-repeat;
padding-right: 17px;
}
With Boostrap 2.3.2
HTML
<div class="left-inner-addon ">
<i class="icon-user"></i>
<input type="text" class="form-control" placeholder="User Name" name='j_username' >
</div>
CSS
.left-inner-addon {
position: relative;
}
.left-inner-addon input {
padding-left:20px;
height:20px;
}
.left-inner-addon i {
position: absolute;
margin:7px 5px;
}
JSFFIDLE

css layout in php gallery

I've been working on a gallery made in php. Some time ago, I made the layout using tables. It worked out super. Now, using tables for layouts is not recommended and sort of "deprecated" (I don't understand why, if someone could explain this to me, thank you). So, I'm trying to change the layout from tables to divs and I'm having a lot of problems (can someone recommend a good reference to how to make a good layout using css?). So far I managed this: http://jsfiddle.net/hochvater/4DbUU/ . MY FIRST QUESTION is this: how do I make the #panel_poze div to show up in the top of the container div, glued to the #panel_albume (as it is now)? I don't understand why #panel_albume is lined with the 3rd div contained by the div it is glued to (#panel_albume). My second question would be this: can't I just put the big table (you can imagine easily how it looks by the structure of the divs) into a container div and sort of leave it as it was...would this still be considered "deprecated" or not recommended?
THE CSS CODE:
body {
background-color: black;
color: white;
}
#font-face {
font-family:"john_handy";
src: url("john_handy.eot");
src: local("¢"), url("john_handy.woff") format("woff"), url("john_handy.TTF") format("opentype"), url("john_handy.svg#john_handy") format("svg");
}
#font-face {
font-family:"bradley_hand";
src: url("bradley_hand.eot");
src: local("¢"), url("bradley_hand.woff") format("woff"), url("bradley_hand.TTF") format("opentype"), url("bradley_hand.svg#bradley_hand") format("svg");
}
a:link {
color:white;
}
/* unvisited link */
a:visited {
color:white;
}
/* visited link */
a:hover {
color:red;
}
/* mouse over link */
a:active {
color:blue;
}
/* selected link */
.fonty {
text-align:center;
font: italic 30px john_handy, serif;
}
a.fonty {
font-style: normal;
font-size:20px;
}
#pp {
margin: 15% auto;
max-width:80%;
min-width:850px;
text-align: center;
white-space:nowrap;
}
.sec {
position: static;
margin: 0% 4%;
max-width: 20%;
min-width: 200px;
display: inline-block;
}
.imageOff {
border: 3px solid transparent;
margin: auto;
}
.imageOn {
border: 3px solid red;
opacity: 0.7;
filter: alpha(opacity=70);
margin: auto;
}
.selected {
padding: 2px;
border: 1px solid red;
}
.submit {
/*margin: 0;*/
border: none;
/*padding: 0;*/
background: black;
font:normal 20px john_handy, serif;
color:white;
}
.subsel {
color:red;
}
.submit:hover {
color:red;
}
.poze_albume {
border: 1px solid red;
height: 250px;
width: 200px;
}
#panel_poze {
border: 1px solid blue;
width: 70%;
min-width: 400px;
display: inline-block;
height: 100px;
}
#panel_albume {
border: 1px solid yellow;
display:inline-block;
}
#container {
text-align: center;
width: 100%;
border: 1px solid white;
min-width: 700px;
}
.album {
}
THE GALLERY CODE:
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="./zastyle.css" />
</head>
<body><!-- oncontextmenu="return false;"> -->
<h1 class="fonty">Portofolio</h1>
<?php
if (!isset($_POST['restart']))
{
?>
<div id="pp">
<div class="sec ">
<form action="./galerie.php" method="post" enctype="multipart/form-data">
<input class="imageOff" onmouseover="this.className='imageOn'" onmouseout="this.className='imageOff'" type="image" src="./studio/photoshoot.JPG" title="Studio Photography" alt="Studio Photography" />
<input type="hidden" name="album" value="studio" />
<input type="hidden" name="restart" value="1"/>
<br />
<input type="submit" class="submit" value="Studio Photography" />
</form>
</div>
<div class="sec ">
<form action="./galerie.php" method="post" enctype="multipart/form-data">
<input class="imageOff" onmouseover="this.className='imageOn'" onmouseout="this.className='imageOff'" type="image" src="./outdoor_lifestyle/lifestyle.jpg" title="Outdoor and Lifestyle Photography" alt="Outdoor and Lifestyle Photography" />
<input type="hidden" name="album" value="outdoor" />
<input type="hidden" name="restart" value="1"/>
<br />
<input type="submit" class="submit" value="Outdoor and Lifestyle" />
</form>
</div>
<div class="sec " >
<form action="./galerie.php" method="post" enctype="multipart/form-data">
<input class="imageOff" onmouseover="this.className='imageOn'" onmouseout="this.className='imageOff'" type="image" src="./landscapes/landscapes.jpg" title="Landscapes" alt="Landscapes" class="album" />
<input type="hidden" name="album" value="landscapes" />
<input type="hidden" name="restart" value="1" />
<br />
<input type="submit" class="submit" value="Landscapes" />
</form>
</div>
</form>
</div>
<?php //require("za_menu.php"); ?>
<?php
}
if (isset($_POST['restart'])&&$_POST['restart']==1){
?>
<div id="container">
<div id="panel_albume">
<div class="poze_albume">
<form action="./galerie.php" method="post" enctype="multipart/form-data">
<input class="imageOff <?php
if($_POST['album']=='studio') echo 'selected';
?>" onmouseover="this.className='imageOn'" onmouseout="this.className='imageOff <?php
if($_POST['album']=='studio') echo 'selected';
?>'" type="image" src="./studio/photoshoot.JPG" title="Studio Photography" alt="Studio Photography" />
<input type="hidden" name="album" value="studio" />
<input type="hidden" name="restart" value="1" />
<br />
<input type="submit" class="submit <?php
if($_POST['album']=='studio') echo 'subsel';
?>" value="Studio Photography" />
</form>
</div>
<div class="poze_albume">
<form action="./galerie.php" method="post" enctype="multipart/form-data">
<input class="imageOff <?php
if($_POST['album']=='outdoor') echo 'selected';
?>" onmouseover="this.className='imageOn'" onmouseout="this.className='imageOff <?php
if($_POST['album']=='outdoor') echo 'selected';
?>'" type="image" src="./outdoor_lifestyle/lifestyle.jpg" title="Outdoor and Lifestyle Photography" alt="Outdoor and Lifestyle Photography" />
<input type="hidden" name="album" value="outdoor" />
<input type="hidden" name="restart" value="1" />
<br />
<input type="submit" class="submit <?php
if($_POST['album']=='outdoor') echo 'subsel';
?>" value="Outdoor and Lifestyle" />
</form>
</div>
<div class="poze_albume">
<form action="./galerie.php" method="post" enctype="multipart/form-data">
<input class="imageOff <?php
if($_POST['album']=='landscapes') echo 'selected';
?>" onmouseover="this.className='imageOn'" onmouseout="this.className='imageOff <?php
if($_POST['album']=='landscapes') echo 'selected';
?>'" type="image" src="./landscapes/landscapes.jpg" title="Landscapes" alt="Landscapes" class="album"/>
<input type="hidden" name="album" value="landscapes" />
<input type="hidden" name="restart" value="1" />
<br />
<input type="submit" class="submit <?php
if($_POST['album']=='landscapes') echo 'subsel';
?>" value="Landscapes" />
</form>
</div>
</div>
<div id="panel_poze"></div>
</div>
<?php }
session_destroy();
?>
</body>
</html>
Thank you for your time invested in reading this and any ideas would be appreciated.
I'd recomend you to take a look at a CSS grid system, such as Twitter Bootstrap or 960.gs
To answer your question about tables: the use of tables were ok before CSS. CSS will help you organize your content in much better and flexible ways. I suggest you take a look at CSS Tricks and the W3 CSS tutorials to make sure you understand how <div> works and how you can float them around. Also, HTML5 take the semantic meaning of the containers and will allow you to better represent the structure of your site. Take a look at HTML5 Boilerplate if you want to learn more or even get a initial template to work with.
Roping off of Andre's answer above. A good way to practice is to simply make a website which has very basic CSS properties, but multiple different formats of the divs, so that you can understand how the boxes interact.
One such project that I did way back when was to simple make a site with a header, a horizontal navigation, then several content blocks that were full-width, 50% - 50% dual columns, 25% - 50% - 25% triple column, 33% - 33% - 33% triple, and 25%-25%-25%-25% quad columns, then a footer.
Something you should definitely be looking into is responsive layout so you can make your gallery mobile friendly.
Edit:
Is this what you were meaning as far what you want it to look like?
http://jsfiddle.net/4DbUU/1/
I changed these rules:
#panel_poze {
border: 1px solid blue;
width: 70%;
min-width: 400px;
height: 100px;
float: left;
}
#panel_albume {
border: 1px solid yellow;
float: left;
}
#container {
text-align: center;
width: 100%;
border: 1px solid white;
min-width: 700px;
clear: both;
overflow: hidden;
}
I deleted your display: inline-block; and added float: left; to both children. Then I told the container to set overflow:hidden; and to clear:both; (left and right floats)
Edit 2:
For clarity requested by the OP...
In lamens terms, when using float:left or float:right on an element, in a way picks that element up off the page and allows it to "float" which ever direction you tell it to. It performs this float with complete disregard to elements that are nearby which are not floated. Elements that are nearby then start to wrap around the floated element. This is sometimes desirable, for example floating an image left or right and allowing the text to wrap around the image. In some cases however you don't want other elements to wrap around the ones you have floated. In those cases you use the clear command to tell the next closest element to not wrap around floated elements. See these two examples:
http://jsfiddle.net/GL4Pn/2/
In the above example, no clear is present. Notice the text in the yellow .footer div is coming up between the two floated elements.
http://jsfiddle.net/GL4Pn/3/
In this example I have added clear: left; to .footer (the yellow div). Notice it is no longer wrapping up into the tiny space between divs, but it is still wrapping aroudn the element to the right.
http://jsfiddle.net/GL4Pn/4/
Here I have switched it to clear: right; notice it is no longer wrapping up to the left div or in the space between divs anymore. It is nested neatly beneath the right div. This is because the right div is the longest div. If I was to increase the height of the left div to be longer than the right div...
...Like here: http://jsfiddle.net/GL4Pn/5/
Notice now the div wraps up to the right, but not between the divs. Now.. If I change the code to clear: both;...
http://jsfiddle.net/GL4Pn/6/
Notice it is back to how it was with clear:right when the right div was longest. And if I change the left div to be shorter than the right and keep clear:both in place...
http://jsfiddle.net/GL4Pn/7/
The same result as before...
It is important to note that elements will only wrap floats if they are the very next element in the code. If I go back to the first example with no clear, but add an extra div beneath footer, you'll see that it does not misbehave as the .footer div has already take the available space.
http://jsfiddle.net/GL4Pn/8/

CSS Positioning: A row of floating left, followed by a block underneath

I want a row of blocks from left to right, followed by a block underneath.
Here is a picture of what I would like to see rendered in the browser.
I need to do all positioning by CSS, not by tables. Here is my HTML and my CSS...
<!DOCTYPE html>
<html>
<head><link rel="stylesheet" href="demo.css" /><head>
<body>
<form action="">
<fieldset>
<legend>Field set A</legend>
<label for="password">Password
<input id="password" name="password" type="text" value="my password" />
</label>
</fieldset>
<fieldset class="radio">
<legend>Chaining mode</legend>
<label for="chain-cfb">
<input id="chain-cfb" name="chain" type="radio" />CFB
</label>
<label for="chain-cbc">
<input id="chain-cbc" name="chain" type="radio" />CBC
</label>
</fieldset>
</form>
<hr />
<p style="padding-top: 1em;">Some text underneath</p>
</body>
</html>
... and here is the content of demo.css...
fieldset
{
float: left;
display: block;
width: 17em;
margin: 0 1em 1em 0;
padding: 0 1em 1em 1em;
}
fieldset.radio input
{
clear: both;
float: left;
width: auto;
}
input
{
display: block;
width: 15em;
}
label
{
display: block;
margin-bottom: 1em;
font-weight: bold;
}
label.first
{
padding-top: 1em;
}
The way I read it, should be getting the desired result with this code. But I am not. Here is what renders instead ....
What changes do I need to make to my html/css in order to get the stated desired result?
A way without clearing is:
form { overflow: hidden; }
I usually create a class called floatbox and use this on every container which contains floating elements
.floatbox { overflow: hidden; }
the matching html then is
<form class="floatbox" action="">
<fieldset><p>I'm floating</p></fieldset>
<fieldset><p>me too</p></fieldset>
</form>
you need to make the <hr /> element clear the floats. hr { clear: left; }
Add:
hr {
clear: left;
}
to your style sheet to clear your floats.
You could use the ole' dummy clearing element trick:
<form action="">
<fieldset>
<legend>Field set A</legend>
<label for="password">Password
<input id="password" name="password" type="text" value="my password" />
</label>
</fieldset>
<fieldset class="radio">
<legend>Chaining mode</legend>
<label for="chain-cfb">
<input id="chain-cfb" name="chain" type="radio" />CFB
</label>
<label for="chain-cbc">
<input id="chain-cbc" name="chain" type="radio" />CBC
</label>
</fieldset>
<div style="clear:both"> </div>
</form>
This ensures your form actually occupies as much space as the elements inside it.
The problem with simply clearing the hr is that the form has zero width and height, which could be problematic if you're applying styling to the form as well.

css fit 2 elements to 100% width

I have this HTML:
<div>
<label>field 1</label>
<input type="text">
<label>field 2</label>
<input type="text">
<label>field 3</label>
<input type="text">
</div>
How can I make a label-input pair use 100% of the width with CSS ? (and each pair be on their own line)
I used to put the label-input pair in a sub div of their own. But I'm wondering if there's a way to do it with just CSS. (I'm using compass to generate the CSS).
For bonus points .. can you have the same CSS make the label a line above on mobile (small screen) devices.
Thanks heaps.
Sort of like this? http://jsfiddle.net/m6pZH/13/
I suggest you modify your HTML slightly, as it will be hard (if even possible) to properly maintain your current HTML properly:
<ul>
<li>
<label>field 1</label>
<input type="text" />
</li>
<li>
<label>field 2</label>
<input type="text" />
</li>
<li>
<label>field 3</label>
<input type="text" />
</li>
</ul>
CSS:
li {
display: block;
overflow: auto;
}
li > label {
float: left;
}
li > input {
width: auto;
float: right;
}
Try this:
div label, div input {
display: block;
}
displaying elements on block puts them on their own line and makes them a block element.
Edited content:
div { width: 600px }
div label { float: left; width: 200px; }
div input { float: right: width: 390px; }
Try this.

CSS: Two inputs side by side

How can I make this:
Look like this:
I.e have the two fields and the sign in buttons side by side? Thanks
Give both fields a different class and assign to the most left one float:left;
HTML:
<input type="text" class="field1"/>
<input type="text" class="field2"/>
CSS:
.field1 {
float:left;
}
I assume this is more what you need:
http://jsfiddle.net/mrchris2013/NtVuq/12/
HTML:
<label>Username</label>
<label>Password</label>
<input type="text" />
<input type="text" />
<input type="button" value="Login" />
CSS:
label, input[type=text] {
width: 150px;
float: left;
}
label + input[type=text] {
clear: left;
}
input[type=button] {
float: left;
}

Resources