Quote Form display none media queries - css

I have developed a custom quote form for a client and when the user scroll down I add a class called .quoteform-fixed it also has an id called #quoteForm however I am trying to hide the entire quote form using media queries. Here is the css I am using....
#media screen and (max-width:1670px) and (min-width:1199px){
.quoteform-fixed {display:none !important}
}
#media screen and (max-width:1198px) and (min-width:767px){
.quoteform-fixed {display:none !important}
}
#media screen and (max-width:766px) and (min-width:220px){
.quoteform-fixed {display:none !important}
}
Here is the main rules for quoteform-fixed...
.quoteform-fixed {
position: fixed;
top: 35px;
right: 35px;
display: block;
}
here is the form HTML...
<div id="quoteForm" class="quote-form">
<div id="quoteFormHead"></div>
<form action="<?php the_permalink(); ?>" method="post">
<div id="quoteFormBody">
<div class="formfullwrapper">
<input type="text" name="message_fname" placeholder="Enter your full name here...">
</div>
<div class="formfullwrapper">
<input type="email" name="message_email" placeholder="Enter your email address here...">
</div>
<div class="formfullwrapper">
<input type="number" name="message_phone" placeholder="Enter your phone number here...">
</div>
<div class="formfullwrapper">
<textarea name="message_msg" placeholder="Details, please! Audience? Word count? Type of document? Tone? Deadlines? Sensitive content?"></textarea>
</div>
</div>
<div id="quoteFormFooter">
<div class="formfullwrapper">
<input type="submit" id="submitform" value="Get my free quote">
</div>
</div>
</form>
</div>
And here is the Javascript to add the class on scroll...
window.onscroll = function(){
var top = window.pageYOffset || document.documentElement.scrollTop;
var form = document.getElementById('quoteForm');
if (top > 800) {
form.classList.add("quoteform-fixed");
} else {
form.classList.remove("quoteform-fixed");
}
}
Many thanks,
Phillip

Not sure why you are adding three media queries to apply the same property, but creating it with the max and min flipped should work.
form {
width: 100vw;
height: 600px;
background: tomato;
}
#media (min-width: 300px) and (max-width: 600px) {
.quoteform-fixed {
display: none;
}
}
<form class='quoteform-fixed'>
</form>

Related

CSS Media query for grouping float-start bootstrap5.2

I ve impleemented an email form in html/css using bootstrap 5.2.
It looks good in the desktop view as well as in the mobile view but it has some issues in the medium sized screens.
I want the string "Given name:" (#given_name_text) to jump to the next line as soon as it's input field (#given_name_input) is jumping to the next line. The problem is present in the range of (min-width: 520px) and (max-width: 991px), that s why I ve already set up the media query, but I do not know what to enter.
Please find my html and css attached.
I am very greatfull for any hint!
moussioG4
#surname_text {
font-weight: 700;
width: 90px;
}
#surname_input {
width: 300px;
height: 30px;
margin-bottom: 20px;
}
#given_name_text {
font-weight: 700;
width: 130px;
text-align: right;
}
#given_name_input {
width: 300px;
height: 30px;
margin-bottom: 20px;
}
#email_text {
font-weight: 700;
width: 140px;
}
#email_input {
width: 300px;
height: 30px;
margin-bottom: 20px;
}
#message_text {
font-weight: 700;
width: 160px;
}
#message_input {
width: 100%;
height: 250px;
margin-bottom: 20px;
}
#message_button {
width: 130px;
height: 30px;
margin-bottom: 20px;
background-color: #f46530;
font-weight: 700;
color: #E7E7E7;
border: 3px solid #0c0c0c;
}
#message_button:hover {
background-color: #0c0c0c;
}
#media (max-width: 519px) {
#given_name_text {
text-align: left;
}
}
#media (min-width: 520px) and (max-width: 991px) {
}
<div id="main-content" class="container">
<h1>Contact Us</h1>
<p>Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form
Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form Use this form
</p>
<div id="name_input" class="row">
<label for="surname_input" id="surname_text" class="float-start">Surname:</label>
<input id="surname_input" class="float-start" type="text">
<label for="given_name_input" id="given_name_text" class="float-start">Given name:</label>
<input id="given_name_input" class="float-start" type="text">
</div>
<div id="mail_input" class="row">
<label for="email_input" id="email_text" class="float-start">E-mail address:</label>
<input id="email_input" class="float-start" type="email">
</div>
<label for="meessage_input" id="message_text">Your message:</label>
<input id="message_input" type="text">
<button type="button" id="s">Send message</button>
</div>
Picture of issue
In case somebody has a similar issue: Solved it by applying the following grid:
<div id="name_input" class="row">
<div class="col-lg-6 col-md-12">
<label for="surname_input" id="surname_text">Surname:</label>
<input id="surname_input" type="text">
</div><!-- End of surname input -->
<div class="col-lg-6 col-md-12">
<label for="given_name_input" id="given_name_text">Given name:</label>
<input id="given_name_input" type="text">
</div><!-- End of given name input -->
</div><!-- End of name input -->

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

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>

A weird issue on CSS selector

I'm using Bootstrap 3 and want to override the default margin-bottom when screen min-width is 768, for inline form groups belonging to a form identified by #filter. So I did:
#media screen and (min-width: 768px) {
#filter .form-inline .form-group {
margin-bottom: 4px;
}
}
But it doesn't work, even when I added important! on the rule.
However, it does work after I removed the #filter in selector:
#media screen and (min-width: 768px) {
.form-inline .form-group {
margin-bottom: 4px;
}
}
That's really weird! I'm sure and tested that #filter can select the form. Can anyone tell me why?
The piece of code in Bootstrap I want to override is:
#media (min-width: 768px) {
.form-inline .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
...
}
But I only want to override this for the form #filter
The HTML code for the form is:
<form class="form-inline" id="filter" method="GET" action="<%= url("/blogs", false) %>">
<div class="form-group">
<label for="id" class="control-label">ID</label>
<input class="form-control" id="id" name="id" value="<%= params[:id] %>" />
</div>
<div class="form-group">
<label for="user_id" class="control-label">UID</label>
<input class="form-control" id="user_id" name="user_id" value="<%= params[:user_id] %>" />
</div>
...
<button type="submit" class="btn btn-default">Filter</button>
</form>
You are using the wrong selector #filter .form-inline. This means that .form-inline is the child of #filter which is incorrect.
What you need is #filter.form-inline which is a multi-selector. See Multiple Class / ID and Class Selectors

Responsive design for elements

How can I make an element with class properties display as inline-block for laptops and desktops and a list for tablets and mobiles?
Whenever I shrink the width of my browser, iPad design elements do not fit properly.
.properties {
display: inline-block;
}
#media screen and (min-device-width: 1200px) and (max-device-width: 1600px) and (-webkit-min-device-pixel-ratio: 1) {
.properties {
display: inline-block;
}
.propertyButton {
display: inline-block;
}
}
#media (max-width: 900px) {
.properties {
display: list-item;
list-style-type: none;
}
.propertyButton {
margin-top: -2%;
margin-left: 30%;
}
}
<div class="propertyWrapper" style="width:100%;">
<div style="float:right">
<span ng-click="addProperty()" class="button buttonPrimary pull-right">Add Property</span>
</div>
<div class="properties">
<label>Name</label>
<input type="text" />
</div>
<div class="properties">
<label>Name</label>
<input type="text" />
</div>
<div class="properties">
<label>Name</label>
<input type="text" />
</div>
<div class="properties">
<label>
IsRequired(TE):
</label>
<input type="checkbox" ng-model="property.TradeEarthRequired" name="UsedEquipmentPropertyList[0].TradeEarthRequired" class="ng-pristine ng-valid">
</div>
<div class="propertyButton">
<span class="button primaryAction" ng-click="addProperty()">Add</span>
<span class="button primaryAction" ng-click="removeProperty(property,$index)">Delete</span>
</div>
</div>
Sometimes, you just need to duplicate the code.
Keep an inline-block view for windows sized over 1200.
When you are under 1200, just hide it and show a fresh new list ?
I think you've just got your CSS a bit wrong - the media queries shouldn't be nested like that, as far as I can tell. Is this JSFiddle more like what you wanted?
.properties {
display: inline-block;
}
#media screen and (min-device-width: 1200px) and (max-device-width: 1600px) and (-webkit-min-device-pixel-ratio: 1) {
.properties {
display: inline-block;
}
.propertyButton {
display: inline-block;
}
}
#media screen and (max-width: 900px) {
.properties {
display: list-item;
list-style-type: none;
}
.propertyButton {
margin-top:-2%;
margin-left: 30%;
}
}

Table Cell Spacing Issues

Hi Guys I am using a table: cell-spacing layout for my website and I need some help. I have a two column website, one being the sidebar and the other containing the content. However, if I add any margins within one of the table-cell divs it moves the side bar spacing with it. I need the spacing on these two cells to be different, and I am not sure how to do so.
My code is as follows:
The CSS:
content {
width : 100%;
display : table;
margin : 0 auto;
height : 100%;
}
#side_bar, #main {
display : table-cell;
}
#side_bar {
border: 1px solid #111;
width: 13%;
background: linear-gradient(#444, #111);
}
#main {
width: 65%;
}
#contact_box {
margin-left: 30%;
margin-top: 7%;
background-color: #111;
opacity: 0.3;
width: 500px;
height: 500px;
}
The HTML:
<div id="content">
<div id="main">
<div id="contact_box">
<form method="post" id="contact_form" action="contact.php">
<p>Full Name:</p> <input type="text" size="40" id="fullname" name="fullname"><br/>
<p>Email Address:</p> <input type="text" size="40" id="email" name="email"><br/>
<p>Type of Inquiry:</p> <input type="text" size="40" id="question" name="question"><br/>
<p>Message:</p> <textarea rows="20" cols="45"></textarea><br/>
<input type="submit" style="float:right; text-transform: uppercase;" value="Send">
</form>
</div>
</div>
<div id="side_bar">
<div id="divider"><h1>News Blurb</h1></div>
<div id="news"><?php //print_news(); ?></div>
<div id="divider"><h1>Featured Games</h1></div>
<div id="featured"><?php //echo $games ?></div>
</div>
</div>
Thank you for any and all help.
Try:
#side_bar {
vertical-align:top;
}

Resources