Angular UI Bootstrap datepicker half date coloring - css

I have a question that is similar to this question on jQuery datepicker show half day blocked
I need to style a date field diagonally.
For example, in booking calendars when people are leaving in the morning or coming at the afternoon.

Well the solution in the problem you linked to was to use a linear gradient like this:
.css-class-to-highlight a {
background: linear-gradient(red 50%, green 50%);
}
I'm not sure what it buys you, but you can use a linear-gradient() and specify the angle in degrees like this:
div[datepicker] table td button {
background: linear-gradient(-45deg, #4AD34A 50%, #009EFF 50%) !important;
}
You've asked for a CSS only solution that will only affect the visual presentation of the data. If that's what you want you're all set. If you wanted to take different actions based each quadrant, you'd need a more sophisticated setup.
Demo in Stack Snippets
var app = angular.module('ui.bootstrap.module', ['ui.bootstrap']);
app.controller('ui.bootstrap.ctrl', function ($scope) {
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
});
div[datepicker] table td button {
background: linear-gradient(-45deg, #4AD34A 50%, #009EFF 50%) !important;
}
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.0/ui-bootstrap-tpls.js"></script>
<div ng-app="ui.bootstrap.module" >
<div ng-controller="ui.bootstrap.ctrl">
<div class="row">
<div class="col-xs-6">
<p class="input-group">
<input type="text" class="form-control"
datepicker-popup
ng-model="dt"
is-open="opened"
ng-required="true"
close-text="Close" />
<span class="input-group-btn">
<button type="button" class="btn btn-default"
ng-click="open($event)">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
</p>
</div>
</div>
</div>
</div>

Related

ng-bootstrap datepicker CSS issue - missing glyphicon

I am using:
Angular 7.2.4
Bootstrap 4.3.1
ng-bootstrap 4.1.0.
After I followed the getting-started guide on ng-bootstrap, my output looks like this:
How can I add the correct style to the Popup button?
My html:
<form class="form-inline">
<div class="form-group">
<div class="input-group">
From:
<input class="form-control" placeholder="{{format}}"
name="FromDp" [(ngModel)]="fromDateObj" ngbDatepicker #d="ngbDatepicker">
<div class="input-group-append">
<button class="btn btn-outline-secondary calendar" (click)="d.toggle()" type="button"></button>
</div>
</div>
</div>
</form>
http://plnkr.co/edit/NCNmpm3tlxapH4jZS08F?p=preview
Check the working demo here
If you open the stackblitz code here - you will see bootstrap css added to index.html & also check styles.css in the stackblitz above to find:
/* Datepicker popup icon */
button.calendar, button.calendar:active {
width: 2.75rem;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAcCAYAAAAEN20fAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEUSURBVEiJ7ZQxToVAEIY/YCHGxN6XGOIpnpaEsBSeQC9ArZbm9TZ6ADyBNzAhQGGl8Riv4BLAWAgmkpBYkH1b8FWT2WK/zJ8ZJ4qiI6XUI3ANnGKWBnht2/ZBDRK3hgVGNsCd7/ui+JkEIrKtqurLpEWaphd933+IyI3LEIdpCYCiKD6HcuOa/nwOa0ScJEnk0BJg0UTUWJRl6RxCYEzEmomsIlPU3IPW+grIAbquy+q6fluy/28RIBeRMwDXdXMgXLj/B2uimRXpui4D9sBeRLKl+1N+L+t6RwbWrZliTTTr1oxYtzVWiTQAcRxvTX+eJMnlUDaO1vpZRO5NS0x48sIwfPc87xg4B04MCzQi8hIEwe4bl1DnFMCN2zsAAAAASUVORK5CYII=') !important;
background-repeat: no-repeat;
background-size: 23px;
background-position: center;
}

Bootstrap button outline

I have a problem with a button.
I want to fix that gray effect on click but i don't know how to do so.
<div class="col-lg-7 col-sm-5 col-md-11">
<form class="navbar-form">
<div class="input-group">
<input type="text" class="form-control" placeholder="Look for something cool">
<div class="input-group-append">
<button class="btn btn-outline-secondary"><i class="fas fa-search"></i></button>
</div>
add this to your css
button:focus {
box-shadow: none !important;
outline: none !important;
}
PS: it's not recommended to remove it, as it is meant to make the user experience more accessible for people with disabilities or people who are not using touch/mouse as control (for example, if you're trying to navigate to that button using TAB button it will be very hard)
Do you mean the hover? if so create some custom CSS that states:
.btn-outline-secondary:hover{
// YOUR STYLES HERE (the grey comes from the background so...)
background: red (or whatever you want)
}
I think you are referring to the outline of the button when clicked/focused.
here is the CSS you might consider:
.btn:focus {
outline: 0;
}
Here is the detailed answer to your question. Remove blue border from css custom-styled button in Chrome

How to modify wordpress plugin 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 7 years ago.
Improve this question
Please check this link: http://jsfiddle.net/Raakh5/hg6au2y2/
<div id="aq-block-1076-2" class="aq-block aq-block-aq_text_block aq_span4 aq-first clearfix">
<div class="cp-calc-widget" data-calcid="2424" data-anchor="2">
<form class="widgetForm cleanslate" id="widgetForm" method="post"
style="width: 260px !important; background-color: #378CAF !important;
border-color: #006395 !important; color: #ffffff !important; font-size: 16px !important;">
<input name="numFields" type="hidden" value="1">
<input name="calcId" type="hidden" value="2424">
<input name="answer_format" type="hidden" value="function">
<div class="widgetTitle">Water Intake Calculator</div>
<hr style="color: #006395 !important; background-color: #006395 !important;">
<div class="form_area"><div class="field">Weight:<div class="buffer">
<input class="inputArea" name="input0" value="">
</div>
</div>
<input type="submit" id="widgetSubmit" class="widgetSubmit calc_button" value="Calculate"
style="color: #ffffff !important; background-image: -moz-linear-gradient(top, #378CAF, #006395) !important;
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #378CAF),color-stop(1, #006395)) !important;
filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr=#378CAF, endColorStr=#006395, GradientType=0 );
border-color: #006395 !important;">
</div>
<div class="answer_area hidden_class">
<div class="loading">loading...</div>
<div class="actual_answer hidden_class">
<span class="pre_answer"></span>
<div class="answer">
<span class="return_answer"></span></div>
</div>
<div>
<input type="button" id="backButton" class="backButton calc_button" value="< back"
style="color: #ffffff !important; background-image: -moz-linear-gradient(top, #378CAF, #006395) !important;
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #378CAF),color-stop(1, #006395)) !important;
filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr=#378CAF, endColorStr=#006395, GradientType=0 );
border-color: #006395 !important;">
</div>
</div>
</div>
</form>
</div>
I have embedded wordpress plugin pro-calculator and want to change its:
Background Color
Button Color
Want to write lbs in Front of "Weight" as "Weight (lbs)"
Please advise
You have a couple of options.
1) (Recommended) Use a different plugin that doesn't put inline styles directly on html elements. Then you can style it with CSS and not have to battle inline styling.
2) Override the output of their display function. If they are using actions/hooks you should be able to de-register their function that displays the html on the page, copy it into your own function, and register your function in place of theirs. This would be nice becasue you could change output such as adding (lbs) to the weight input. Here is an example of doing the action overrides.
The third and worst option is editing the plugin code directly but you will lose all of your changes if a site admin ever does the one-click plugin update in the wp-admin. This is obviously a unwanted scenario.
Okay I guess I found out a way, which is possible but a hack. Since ids are all same and you do use jQuery, it is easy to change it using .css(). Give this a try, which you are supposed to put in the CSS:
(function ($) {
setTimeout(function () {
$(function () {
$("#widgetForm").css({
"border-width": "2px",
"background-color": "#ccc",
"border-color": "#99f"
});
});
}, 1250);
})(jQuery);
Also, let's give a simple setTimeout() so that it takes the time to load the plugin. :)
Fiddle: http://jsfiddle.net/praveenscience/2fqk93av/

Make div visible when option is checked

I have looked over several different questions helping me get to this point however I can't figure out the selector that allows me to get to an outside DIV.
If I remove the two containing DIVs the code works perfectly, However with formatting I need the divs to be able to control the look. Any help would work I know the ~ is the child selector which is why it works without the DIVs.
How do I select any DIV?
Code:
.reveal-if-active {
color: #ccc;
font-style: italic;
opacity: 0;
transform: scale(0.8);
max-height: 0px;
transition: 0.5s;
}
input#photo1:checked ~ div#portraits,
input#photo2:checked ~ div#wedding,
input#photo3:checked ~ div#other {
color: #f00;
font-style: normal;
transform: scale(1);
opacity: 1;
max-height: 150px;
}
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<form>
<div class="eight columns" data-scroll-reveal="enter bottom move 100px over 0.6s after 0.2s">
<label for="photo">
<span class="error" id="err-phone">Please Select What you are looking for?</span>
</label>
<input class="radio_activator_portraits" name="photo" id="photo1" type="radio" value="portraits">
<label for="photo1">Portraits</label>
<input class="radio_activator_weddings" name="photo" id="photo2" type="radio" value="wedding">
<label for="photo2">Wedding</label>
<input class="radio_activator_other" name="photo" id="photo3" type="radio" value="other">
<label for="photo3">other</label>
</div>
<div class="eight columns reveal-if-active" id="portraits" name="portraits">Portraits</div>
<div class="eight columns reveal-if-active" id="wedding" name="wedding">Wedding</div>
<div class="eight columns reveal-if-active" id="other" name="other">Other</div>
</form>
</body>
</html>
I think you can't yet style a parent based on descendants with CSS only, you might consider using Javascript or jQuery maybe. Look at this links:
Parent Selectors in CSS, Is there a CSS parent selector?
Try this HTML structure:
<body>
<form>
<div class="eight columns" data-scroll-reveal="enter bottom move 100px over 0.6s after 0.2s">
<label for="photo">
<span class="error" id="err-phone">Please Select What you are looking for?</span>
</label>
<input class="radio_activator_portraits" name="photo" id="photo1" type="radio" value="portraits">
<label for="photo1">Portraits</label>
<input class="radio_activator_weddings" name="photo" id="photo2" type="radio" value="wedding">
<label for="photo2">Wedding</label>
<input class="radio_activator_other" name="photo" id="photo3" type="radio" value="other">
<label for="photo3">other</label>
<div class="eight columns reveal-if-active" id="portraits" name="portraits">Portraits</div>
<div class="eight columns reveal-if-active" id="wedding" name="wedding">Wedding</div>
<div class="eight columns reveal-if-active" id="other" name="other">Other</div>
</div>
</form>
</body>
In order to get this working, you'll need to have the items that have the reveal-if-active class in the same div container with the option. Check this article.
To position them outside of the parent <div> use positioning on .reveal-if-active class:
position:absolute;
top: 40px;
See Example.
cchacholiades is correct -- you will need javascript to do what you want. +1
On a CSS hover event, can I change another div's styling?
However, the javascript for what you desire is quite simple -- it would look something like this:
$(document).ready(function(){
$('input[name="photo"]').click(function(){
var phot = $(this).val();
$('#'+phot).show().css({'background':'yellow','opacity':'1'});
});
});
jsFiddle Demo
Notes:
(1) Because you already have the ID of the desired DIV stored as the value of the clicked radio button, it is simple to capture that value: $(this).val() -- $(this) refers to the element that was clicked on
(2) I demonstrated using both .show() -- which is the same as css display:block, and actually using css statements themselves.
Frankly, I think it will be faster for you just to use jQuery to do this. The only caveat is you must load the jQuery library, usually in the <head> tags like this:
<head>
<!-- other stuff in head -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
If you want some fast lessons on jQuery, find free video tuts here:
https://www.thenewboston.com/videos.php?cat=32
or at
http://phpacademy.org

Bootstrap navbar search icon

The bootstrap examples for the navbar search form have just a text box.
I'd like to be able to add a search icon at the beginning, like Twitter does on their search box. How can I do this with bootstrap?
Here's what I've tried so far but it's failing:
http://jsfiddle.net/C4ZY3/3/
Here's how to use the :before pseudo selector and glyphicons for Bootstrap 2.3.2 instead of a background image on the input.
Here's a couple of simple examples: http://jsfiddle.net/qdGZy/
<style type="text/css">
input.search-query {
padding-left:26px;
}
form.form-search {
position: relative;
}
form.form-search:before {
content:'';
display: block;
width: 14px;
height: 14px;
background-image: url(http://getbootstrap.com/2.3.2/assets/img/glyphicons-halflings.png);
background-position: -48px 0;
position: absolute;
top:8px;
left:8px;
opacity: .5;
z-index: 1000;
}
</style>
<form class="form-search form-inline">
<input type="text" class="search-query" placeholder="Search..." />
</form>
Update For Bootstrap 3.0.0
Here's an updated fiddle for bootstrap 3.0: http://jsfiddle.net/66Ynx/
One of the way to do it is to add left padding to the field and add background image for the field.
See example: http://jsfiddle.net/hYAEQ/
It's not exact way twitter.com do it, they used absolute position element above search field because they have all images in the single sprite, and can't easily use them as backgrounds, but it should do.
I used inline image for a background to make it easier to post it to jsfiddle, but feel free to use normal links to images here.
EDIT: The way to do it using bootstrap sprite and additional container for icon
http://jsfiddle.net/hYAEQ/2/
EDIT 2:
Fix for white bootstrap theme: http://jsfiddle.net/hYAEQ/273/
EDIT 3:
If you are using navbar-inverse (black navbar) you will want this minor tweak: http://jsfiddle.net/hYAEQ/410/
.navbar-search .search-query {
padding-left: 29px !important;
}
Play this fiddle, I put some rosin on the bow for you:
http://jsfiddle.net/pYRbm/
.fornav {
position:relative;
margin-left:-22px;
top:-3px;
z-index:2;
}
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<form class="navbar-search">
<div class="input-append">
<input type="text" class="search-query span2" placeholder="Search…"><span class="fornav"><i class="icon-search"></i></span>
</div>
</form>
</div>
</div>
</div>
You can also not touch the css at all by using prepending form inputs like so
<form class="navbar-search">
<div class="input-prepend">
<span class="add-on"><i class="icon-search"></i></span><input name="url" type="text" class="span2" placeholder="Page Url">
</div>
</form>
Note that whitespace between </span> and <input> will create a gap between the icon and the text box.
In bootstrap 3.x.x
<div class="input-group">
<input type="text" class="form-control" id="search">
<span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
</div>
The new version 2.1.1 fixes the problem. It doesn't handle the case of the 15 pixel radius, so I went ahead and styled it accordingly. I also added navbar-inverse for fun.
A couple of caveats. The CSS can be better optimized, but recently I've been spoiled by less. Finally, there's an ever so slight, barely visible, left border to the left of the magnifying glass. I don't know exactly what's causing it, but it is likely the box shadow.
Please feel free to fork and improve.
http://jsfiddle.net/joelrodgers/hYAEQ/333/
For those using Rails, my solution is not the most beautiful but works.
<%= form_tag PATH_TO_MODEL, :method => 'get', :class => "navbar-search" do %>
<%= text_field_tag :search, params[:search], :class => "search-query",
:style => "padding-left:29px" %>
<div class="icon-search" style="position:absolute;top:7px;left:11px;"></div>
<% end %>
Bit late to the party on this one ...
I used the following to achieve the search input as an icon
<div class="input-append">
<input id="appendedInputButton" class="span6" type="text" placeholder="Search...">
<button class="btn" type="button"><i class="icon-search"></i></button>
</div>
You should change your approach. Use span.search-query as an overlay - here you have the most important things:
.navbar-search { position: relative } /* wrapper */
.search-query { position: absolute; left: 0; top: 0; z-index: 2; width: x } /* icon */
.span3 { position: relative; z-index: 1; padding-left: x } /* input */

Resources