Style WooCommerce Product Search Widget - css

I got this custom CSS code for the WooCommerce product search bar on the generatepress forums, thanks to David.
When I enter that custom CSS code, the search bar looks like this: https://i.stack.imgur.com/8CMdx.jpg
.woocommerce-product-search {
border-radius: 40px;
overflow: hidden;
display: flex;
flex-direction: row-reverse
}
.woocommerce-product-search input {
border-radius: 0 40px 40px 0;
border-left: 0
}
.woocommerce-product-search button:before {
content: "seach";
font-family: "Arial";
text-align: center;
display: inline-block;
font-size: 15px;
}
.woocommerce-product-search button {
font-size: 0px;
background-color: #fafafa;
color: #666666;
border: 1px solid #cccccc;
border-right: 0;
border-radius: 40px 0 0 40px;
}
I want the bar to stay that way but with the "search" button on the right side, like this: https://i.stack.imgur.com/FaOMt.jpg
Please, could you help me to do it? I would appreciate it very much.
---EDIT 12/11/2020---
HTML:
<div class="woocommerce widget_product_search"><form role="search" method="get" class="woocommerce-product-search" action="https://example.com/">
<label class="screen-reader-text" for="woocommerce-product-search-field-0">Search for:</label>
<input type="search" id="woocommerce-product-search-field-0" class="search-field" placeholder="Search products…" value="" name="s" />
<button type="submit" value="Search">Search</button>
<input type="hidden" name="post_type" value="product" />
</form>
</div>

Not sure that this will solve the issue without seeing the html, but give it a try:
.woocommerce-product-search {
border-radius: 40px;
overflow: hidden;
display: flex;
flex-direction: row;
}

Related

How to align a zoomed checkbox with a label

I have the following html which renders the following
<input type="checkbox" class='btn-filter' style='zoom:2; id="inactive-accounts" name="" value="1">
<label style= 'font-size:15px' for="inactive-accounts">Show Inactive Accounts</label><br>
If the checkbox is a regular size the text lines up well with the checkbox but since I am using zoom to increase the size of the checkbox it is not aligned correctly. I tried a solution I found on stack overflow to create CSS like so:
.checkboxes label {
display: inline-block;
padding-right: 10px;
white-space: nowrap;
}
.checkboxes input {
vertical-align: middle;
zoom:"2"
}
.checkboxes label span {
vertical-align: middle;
}
<input type="checkbox" class='btn-filter' style='zoom:2; justify-content:center' id="inactive-accounts" name="" value="1">
<label style= 'font-size:15px' for="inactive-accounts">Show Inactive Accounts</label><br>
but this does not fix the issue. Could it be that I should not be using zoom to increase the size of the checkbox here?
I highly discourage using the property ZOOM. To increase the element, it is better to use - transform.
https://developer.mozilla.org/en-US/docs/Web/CSS/zoom
.checkboxes {
outline: 1px solid green;
padding: 20px;
font-size: 20px;
display: flex;
align-items: center;
}
.checkboxes input, .checkboxes label {
margin: 0;
min-height: 20px;
display: flex;
align-items: center;
}
.checkboxes label {
white-space: nowrap;
margin-left: 7px;
outline: 1px solid grey;
padding-left: 5px;
}
.checkboxes input {
transform: scale(2);
outline: 1px solid grey;
}
.checkboxes label span {
vertical-align: middle;
}
<div class="checkboxes">
<input type="checkbox" id="inactive-accounts" name="" value="1">
<label for="inactive-accounts">Show Inactive Accounts</label>
</div>
Are you free to wrap your elements in a div or "container" element? If so, you can set display: flex; and align-items: center; onto that element, which would align your input and label.
Here's a snippet showing both a regular and zoomed checkbox alongside a label.
div {
display: flex;
align-items: center;
}
<div>
<input type="checkbox" class='btn-filter' style='zoom:2; justify-content:center' id="inactive-accounts" name="" value="1">
<label style='font-size:15px' for="inactive-accounts">Show Inactive Accounts</label>
</div>
<br>
<div>
<input type="checkbox" class='btn-filter' style='zoom:1; justify-content:center' id="inactive-accounts-2" name="" value="1">
<label style='font-size:15px' for="inactive-accounts-2">Show Inactive Accounts</label>
</div>

HTML/CSS How do I make the display responsive for smaller screens by stacking this as a column?

I was experimenting with building a basic chat room system with HTML and I ran into some issues when attempting to implement responsive design for small-screen platforms. I've tried and tried for hours with all sorts of different solutions but am unfortunately still stuck. :(
I should just say, I'm an extremely inexperienced programmer in this area I should warn you the code is messy.
I've attached an image of the basic display on the wide screen of my PC.
Images:
Small-screen attempt at display and
Basic large-screen attempt at display
I have also attached an image of what happens when I try to shrink it - namely, half of it goes off screen and the other half is only accessible through scrolling.
Here's the code:
<!DOCTYPE html>
<html>
<head>
<title>
Grav1ty: Login
</title>
<link rel="stylesheet" href="gravitystyle.css">
<meta charset="UTF-8">
<meta name="description" content="Grav1ty Chat">
<meta name="keywords" content="Grav1ty, grud, soyuznerushimy, grav1ty">
<meta name="author" content="Grud">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="gravitylogo.PNG" />
</head>
<body style="background-image:url('background.jpg');font-family:Courier New;">
<div class="exampleheader">
<img src="gravitylogo.PNG" alt="Grav1ty Logo">
<p style ="color:white;"><font size="7">Grav1ty</font><p>
</div>
<!--<div class="examplerow">-->
<div class="exampleheadera" class="container" style="padding: 10px; border: none;">
<!--<div class="loginlayout">-->
<div>
<p style="color:#66c3fe;">
<fieldset class="fieldseta" style="color:#66c3fe; padding: 10px; height: 350px; width: 300px;">
<legend><b><h3>Welcome!</h3></b></legend>
Welcome to <b>Grav1ty</b>,<br>Grav1ty is a <b>FREE</b>, online messaging service free from interruption or surveillance that will be developed over the next few months to suit your needs. Any queries? Contact me through Grav1ty! My username's Grud (well duh) and I'll be happy to help you out. Feel free to chat as you see fit...<br><br><i>Grud</i><br><br><b>Current Status: ONLINE</b>
</fieldset>
</div>
<div>
<form style ="color:white;" action="login.php">
<fieldset class="fieldsetb" style="color:#66c3fe; height: 325px; padding: 30px;">
<legend><b><h3>Log in:</h3></b></legend>
Username:
<input type="text" name="username" placeholder="Username" required><br>
<br>Password:
<input type="password" name="password" placeholder="Password" required>
<br>
<br>
<input type="submit" value="SUBMIT" class="buttona">
</form>
</fieldset>
</form>
</div>
<div>
<form style ="color:white;">
<fieldset class="fieldsetc" style="color:#66c3fe; height: 325px; padding: 30px;">
<legend><b><h3>Sign Up:</h3></b></legend>
Name:
<input type="text" name="newname" placeholder="Name" required><br>
<br>Username:
<input type="text" name="newusername" placeholder="Username" required><br>
<br>Password:
<input type="password" name="newpassword" placeholder="Password" required>
<br>
<br>
<input type="submit" value="SUBMIT" class="buttona">
</form>
</p>
</fieldset>
</form>
<!--</div>-->
</div>
</div>
<!--</div>-->
</body>
</html>
And here's the CSS stylesheet:
.buttona {
background-color: #657EEB;
border: 2px solid #1C43EF;
border-radius: 6px;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
margin: 4px 2px;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
}
.buttona:hover {
color: blue;
background-color: white
}
.exampleheader {
padding: 10px;
text-align: center;
background: #9b9ce7;
color: #11f2f2;
border-radius: 2px;
display: flex;
}
.exampleheadera {
padding: 10px;
text-align: center;
background: white;
color: #11f2f2;
border-radius: 2px;
display: flex;
flex-direction: row;
justify-content: center;
}
.examplenavbar {
display: flex;
background-color: #333;
justify-content: space-around;
}
.examplenavbar a {
color: white;
padding: 14px 20px;
text-decoration: none;
text-align: center;
}
.examplenavbar a:hover {
background-color: #ddd;
color: black;
}
.examplerow {
display: flex;
flex-wrap: wrap;
}
/* Create two unequal columns that sits next to each other */
/* Sidebar/left column */
.exampleside {
flex: 30%;
background-color: #f1f1f1;
padding: 20px;
}
/* Main column */
.examplemain {
flex: 70%;
background-color: white;
padding: 20px;
}
/* Fake image, just for this example */
.examplefakeimg {
background-color: #aaa;
width: 100%;
padding: 20px;
}
/* Footer */
.examplefooter {
padding: 20px;
text-align: center;
background: #ddd;
}
/* Responsive layout - when the screen is less than 700px wide, make the two columns stack on top of each other instead of next to each other */
.fieldseta {
display: block;
padding-left: 3px;
padding-right: 3px;
border: 2px solid #b4fef5 ;
background-color: white;
height: 550px
}
.fieldsetb {
display: block;
padding-left: 3px;
padding-right: 3px;
border: 2px solid #b4fef5 ;
background-color: white;
height: 550px
}
.fieldsetc {
display: block;
padding-left: 3px;
padding-right: 3px;
border: 2px solid #b4fef5 ;
background-color: white;
height: 550px
}
.loginlayout {
display: flex;
justify-content: space-between;
border: 3px solid #b4fef5;
padding: 30px;
}
Something like this?
https://codebrace.com/editor/b1d87528b
Here in the example, I have added following property
display: inline-block;
vertical-align: top;
to each and every child div (.contsidebyside) inside .exampleheadera.
and removed
display: flex;
from .exampleheadera
Hope this Helps! :)

CSS display: table or display:table-cell img in safari and internt explorer

Hey all thank you in advances for taking a look at this post!
Ok down to the problem. I have been working on a jooomla 3.0 site now upgraded to a 3.5 site using the Helix 3 framework. i was having an issue with centering the menus and i discovered css display: table property, this solved the problem. i tried to used the dispaly:table property with images in 2 places on the home page. it works just fine in Opera, Fire Fox, Chrome, and Android as well as the browser on the ipad.
Below is the html code
<div class="booktable">
<div class="bcell"><img src="images/sidebar-main.png" alt="" /></div>
<div class="bcell"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="XZF7EPBFS629N" /> <input alt="PayPal - The safer, easier way to pay online!" name="submit" src="images/Organize_His_Way_Teachers_Guide-1.jpg" type="image" /></form></div>
<div class="bcell"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="P3R35E3YK7MLY" /> <input alt="PayPal - The safer, easier way to pay online!" name="submit" src="images/all_things_new.png" type="image" /></form></div>
</div>
<div class="pcell">
<p>All Things New is a compilation of short vignettes that will help liberate you from the entanglement of clutter, and show you how to live a life of space, freedom and peace. I pray that after reading All Things New you too will be transformed from munching through life to soaring high on newly sprouted wing</p></div>
Here is the css:
/*----buttons on home page ----*/
.customimae_ads {
width: 100%;
margin-right: auto;
margin-left: auto;
margin-bottom: 2rem;
display: table;
background-color: #BBF4FB;
border-collapse: separate;
border-spacing: 1rem;
border: 1px solid #02369b;
}
.acell {
display: table-cell;
border: 1px solid #02369b;
box-shadow: .3125rem .3125rem .3125rem #888888;
}
.customimae_ads img {
width:100%;
}
/*---bookstore---*/
.booktable {
width: 100%;
display: table;
margin-left: auto;
margin-right: auto;
border-collapse: separate;
border-spacing: .5rem;
overflow-x: hidden;
background-color: #BBF4FB;
border: 1px solid #02369b;
margin-bottom: .625rem;
}
.bcell {
display:table-cell;
}
.bcell input[type="image"] {
width: 100%;
}
.bcell img {
width: 100%;
}
safari render image
safari table display issue
internet explorer
click to see
/*----buttons on home page ----*/
.customimae_ads {
width: 100%;
margin-right: auto;
margin-left: auto;
margin-bottom: 2rem;
display: table;
background-color: #BBF4FB;
border-collapse: separate;
border-spacing: 1rem;
border: 1px solid #02369b;
}
.acell {
display: table-cell;
border: 1px solid #02369b;
box-shadow: .3125rem .3125rem .3125rem #888888;
}
.customimae_ads img {
width:100%;
}
/*---bookstore---*/
.booktable {
width: 100%;
display: table;
margin-left: auto;
margin-right: auto;
border-collapse: separate;
border-spacing: .5rem;
overflow-x: hidden;
background-color: #BBF4FB;
border: 1px solid #02369b;
margin-bottom: .625rem;
}
.bcell {
display:table-cell;
}
.bcell input[type="image"] {
width: 100%;
}
.bcell img {
width: 100%;
}
.pcell {
float: right;
width 50%;
}
<div class="booktable">
<div class="bcell"><img src="images/sidebar-main.png" alt="" /></div>
<div class="bcell"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="XZF7EPBFS629N" /> <input alt="PayPal - The safer, easier way to pay online!" name="submit" src="images/Organize_His_Way_Teachers_Guide-1.jpg" type="image" /></form></div>
<div class="bcell"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="P3R35E3YK7MLY" /> <input alt="PayPal - The safer, easier way to pay online!" name="submit" src="images/all_things_new.png" type="image" /></form></div>
</div>
<div class="pcell">
<p> All Things New is a compilation of short vignettes that will help liberate you from the entanglement of clutter, and show you how to live a life of space, freedom and peace. I pray that after reading All Things New you too will be transformed from munching through life to soaring high on newly sprouted wing</p>
</div>
Thank you again for your help.
This CSS fixed the issues in Safari for me.
.booktable {
display: flex;
align-items: baseline;
padding: 0.5em 0.25em 0;
}
.bcell {
flex: 1;
padding: 0 0.25em;
}
Before
After

CSS- Coloured cox inside form field

I am a newbie but pretty good at CSS, But i can not seem to get my head around doing the following:
It is the box and background, that is confusing me. The rest i am perfecting fine with. Any pointers would be very helpful. I know bootstrap have a similar plugin, but i find bootstrap a nightmare to use.
I have tired countless of ridiculous things, i am to embarrassed to show, thought is is about time i ask the pro's.
input[type=text]{
background-color: linear-gradient(90deg, #FFC0CB 50%, #00FFFF 50%);
color: black;
}
input[type=text]{
background-color: red;
color: aqua;
background-size: 20%;
}
HTML
<div id="section_left">
<form id="franchiseDets" action ="Franchise-Details.php" method="POST">
<!-- franchise details form-->
<div class="field">
<input type="text" name="fran_name" id="fran_name" value="<?php echo $_SESSION['fran_name']; ?>" placeholder="e.g One Delivery Leeds" pattern="[a-zA-Z]"
autofocus required tabindex="1">
<br>
<input type="email" name="fran_email" id="fran_email" value="<?php echo $_SESSION['fran_email'] ?> ' <?php echo $disabled ?>" placeholder="leeds#one-delivery.co.uk" required tabindex="2">
<br>
<input type="text" name="mang_name" id="mang_name" value="<?php echo $_SESSION['mang_name']; ?>" placeholder="Joe Blogs" required tabindex="3">
<br>
These are last two ridiculous things i have tired
Here is a method I would usually use.
Pure CSS and semantics :)
HTML
<fieldset class="example">
<input type="text" placeholder="Phone" />
</fieldset>
CSS
fieldset.example {
position: relative;
}
fieldset.example,
fieldset.example:before,
fieldset.example input {
height: 33px;
padding: 0;
border-width: 0;
/* remove default border */
}
fieldset.example input {
border: 1px solid red;
border-left: 0px;
padding-left: 5px;
border-radius: 0 5px 5px 0;
}
fieldset.example:before {
content: "\0260E";
width: 30px;
border: 1px solid red;
display: inline-block;
float: left;
position: relative;
background: red;
color: white;
text-align: center;
line-height: 33px;
border-radius: 5px 0 0 5px;
}
LIVE EXAMPLE
http://codepen.io/KarlDoyle/pen/grRrwG
This is how I would have solved it with less code as comment suggested:
(Do not evauluate the design)
.input-field {
/* And border and so on... */
background-color: #f00;
box-sizing: border-box;
padding-left: 2em;
position: relative;
}
.input-field:before {
content: "X"; /* Use this if the icon comes from a font,
or relpace it with a space and then use the background-image property */
position: absolute;
left: 0;
width: 2em; /* Just to center the padding */
text-align: center;
font-size: 1em; /* For the scalability */
}
.input-field > input {
width: 100%;
font-size: 1em;
}
/* This is just for play, to test the scaleability */
.fill-row {
width: 100%;
}
.big {
font-size: 2em;
}
.short {
max-width: 160px;
}
<div class="input-field fill-row">
<input />
</div>
<div class="input-field big short">
<input />
</div>
<div class="input-field short">
<input />
</div>

Make Radio buttons "pretty" with CSS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm working on an app that uses radio buttons. I'm trying to figure out how to make my radio buttons look better than the default radio buttons. However, I have not had any luck finding any examples online. Everything I find changes the radio buttons to a toggle button.
Basically, I want the radio button approach. I just want it to be bigger. I also want the selected radio button in a group to be green.
Is there a way to do this with CSS? If so, how? Or, do I need to use some custom control library?
Thank you!
The prevalent method is to use ::before pseudoelement, and format this. The radio/checkbox must be visually hidden.
input[type="radio"].fancy {
opacity: 0;
margin-right: -12px;
}
input[type="radio"].fancy + label::before {
content: "";
overflow: hidden;
font-size: 10px;
text-align: center;
margin-right: 3px;
display: inline-block;
vertical-align: middle;
border: 1px solid #333333;
background-color: #EEEEEE;
width: 12px;
height: 12px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
input[type="radio"].fancy:checked + label::before {
content: "•";
color: #777777;
background-color: #FFFFFF;
}
input[type="radio"].fancy:disabled + label::before {
background-color: #999999;
}
<p>
<input type="radio" class="fancy" id="radio1" name="radiogroup1" />
<label for="radio1">Fancy radio1</label>
</p>
<p>
<input type="radio" class="fancy" id="radio2" name="radiogroup1" />
<label for="radio2">Fancy radio2</label>
</p>
<p>
<input type="radio" class="fancy" id="radio3" name="radiogroup1" disabled="disabled" />
<label for="radio3">Disabled radio</label>
</p>
Googling for "css customized radio buttons" yielded a lots of useful results, such as this, here is a jsfiddle based on that tutorial, code provided below. Obviously, this is kind of workaround solution rather than native way of styling the radio buttons which to my knowledge doesn't exist.
HTML:
<div class="radio">
<input id="male" type="radio" name="gender" value="male"/>
<label for="male">Male</label>
<input id="female" type="radio" name="gender" value="female"/>
<label for="female">Female</label>
</div>
CSS:
label {
display: inline-block;
cursor: pointer;
position: relative;
padding-left: 25px;
margin-right: 15px;
font-size: 13px;
}
input[type=radio] {
display: none;
}
label::before {
content: "";
display: inline-block;
width: 16px;
height: 16px;
margin-right: 10px;
position: absolute;
left: 0;
bottombottom: 1px;
background-color: #aaa;
box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8);
}
.radio label::before {
border-radius: 8px;
}
input[type=radio]:checked + label::before {
content: "\2022";
color: #f3f3f3;
font-size: 30px;
text-align: center;
line-height: 18px;
}
yes it can be done with the help of background image, below code snippets can be helpful
HTML:
<input type="radio" name="radio" class="radio" /> Yes
<input type="radio" name="radio" class="radio" /> No
CSS :
.radio {
width: 19px;
height: 25px;
padding: 0 5px 0 0;
background: url(radio.png) no-repeat;
display: block;
clear: left;
float: left;
}
links can help :
http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/
http://code.stephenmorley.org/html-and-css/styling-checkboxes-and-radio-buttons/

Resources