how to change triangle to up arrow using pure css - html

Here is fiddle example: example
Question1: I have a flowing arrow triangle css:
.wrapper {
background-color: black;
width: 100px;
height: 100px;
}
.downArror {
float: left;
display: inline-block;
border: 15px solid rgba(0, 0, 0, 0);
border-bottom-color: #fff;
margin: 8px;
}
HTML:
<div class="wrapper"><div class="downArror"></div></div>
Just wondering, is there a way to change the css that make this triangle to a '^' shape?
what I'd like to have is something like this:
Question2:
Is there a way to make a tick like this using code?:
I am currently using &#8730 but, the shape is slightly different

I actually created this effect awhile back for a menu. You can find it here:
http://codepen.io/spikeyty/pen/IFBro
Basically, I took a transparent div, added bottom-left and bottom-right borders, and then rotated the div 45deg using transform. For extra sweetness the example has a neat hover effect. Enjoy!

It's possible using css : (Hope you meant this)
.wrapper{
background-color:black;
width:20px;
height:20px;
text-align:center;
}
.downArror_black:before{
content:'\2227';
color:#fff;
}
.tick:before{
content:'\2713';
color:#fff;
}
<div class="wrapper">
<div class="downArror_black"></div>
</div>
<br />
<div class="wrapper">
<div class="tick"></div>
</div>

Related

Child element crops parent element?

I dont know what title to give for this question. Got from my designer this image:
How can i make something like this?
Like you see there is button in midle who needs to be clickable and background transparent. Around button you see red full width parent. Maybe my approach is not good maybe it can be done with pseudo elements but i dont know how.
Pls help me...
This is my html code:
<div class="pdf">
<div class="pdf-container">
<h3>Rádi byste s námi spolupracovali? Představíme Vám své další výrobky v našem katalogu.</h3>
stáhnout katalog
</div>
</div>
Support isn't fantastic, but mix-blend-mode is the easiest way to achieve your desired look.
.pdf {
background: url('https://media.istockphoto.com/vectors/gear-wheel-vector-rendering-of-3d-wireframe-style-3d-view-layers-of-vector-id1003526726') 50% 10% no-repeat;
text-align: center;
}
.nav {
height: 60px;
background-color: #313131;
mix-blend-mode: multiply;
}
.pdf-container {
padding: 30px;
background-color: red;
mix-blend-mode: multiply;
}
.pdfbutton{
background: white;
border-radius: 20px;
display: inline-block;
padding: 10px 20px;;
}
<div class="pdf">
<div class="nav"></div>
<div class="pdf-container">
<h3>Rádi byste s námi spolupracovali? Představíme Vám své další výrobky v našem katalogu.</h3>
stáhnout katalog
</div>
</div>

Change border color of both divs when hover on one div in css

i have two divs and and i want if when i hover on one div, border color of both divs should be change...
CSS :
.uperdiv {
width:80%;
background-color:black;
margin-left:10%;
border-style:none solid none solid ;
border-width:5px;
border-color:#fff;
border-top-style:none;
height:170px;
margin-top:-220px;
transition:border-color 2s;
-moz-transition:border-color 2s;
-webkit-transition:border-color 2s;
-o-transition:border-color 2s;
}
.uperdiv:hover + .lowerdiv{
border-color:#9900ff;
}
.lowerdiv {
border-style:none solid solid solid ;
border-color:#fff;
border-width:5px;
background-color:black;
width:80%;
border-bottom-left-radius:15px;
border-bottom-right-radius:15px;
height:50px;
margin-left:10%;
}
HTML
<div class="uperdiv">
Some text
</div>
<div class="lowerdiv">
</div>
I tried + sign but it changes lower div border color when i hover on uper div...and you can say that i want to create effects as of one div.
And now i have no idea.. is there any way to do it??
And plz don't use jquery and javascript only css and css3
Thanks in advance :)
Unfortunately, you can't (yet) target the previous sibling using CSS. You could put the two divs in a container, though, and apply the :hover to that.
html
<div class="container">
<div class="upperdiv">
Some text
</div>
<div class="lowerdiv">
Some text 2
</div>
</div>
css
.container:hover .upperdiv,
.container:hover .lowerdiv {
border-color: #9900ff;
}
This way, when you hover either .upperdiv or .lowerdiv, both will have the border-color applied.
We might be able to do this without the container in the future, using the subject indicator
It would look something like this;
.upperdiv:hover,
.upperdiv:hover + .lowerdiv,
.lowerdiv:hover,
!.upperdiv + .lowerdiv:hover { /* target .upperdiv when the next sibling is hovered */
border-color: #9900ff;
}
HTML:
<div class="anyClass">
<div class="upper">
</div>
<div class="lower">
</div>
</div>
Css:
.anyClass:hover div{
border:1px solid #ccc;
}
Just add a container with anyClass to hold your div's
then add the css
You need to add hover for the uper div class:
.uperdiv:hover
FIDDLE
Check it out:
html:
<div class="upperdiv">Some text</div>
<div class="lowerdiv"></div>
css:
.upperdiv, .lowerdiv{
width: 100px;
height: 100px;
border: 1px solid blue;
}
.upperdiv:hover, .upperdiv:hover+.lowerdiv{
border-color: red;
}
It's kind of simplified but it's what you want.
Fiddle: http://jsfiddle.net/b58CU/
Try this
.uperdiv:hover, .uperdiv:hover + .lowerdiv{
border-color:#9900ff;
}
DEMO

Put a line beside my text by css

I want to put a line beside my text Like THIS
----- Hello WOrld -----
the line should be continued and BOLD and align side middle wise And RED
Have you tried :before and :after selectors?
<span class="dashes">Hello WOrld</span>
<style type="text/css">
.dashes { font-weight: bold; }
.dashes:before, .dashes:after { content:"----"; color:#f00; }
</style>
This is how it comes out: image sample
UPDATE
Based on your updates and comments, I think this fits your description:
<h4 class="sidelines"><span>Hello WOrld</span></h4>
<style type="text/css">
h4.sidelines { text-align: center; border-bottom: 1px solid #f00; height: 0.5em; }
h4.sidelines span { display: inline-block; background: #fff; padding:0 0.25em; }
</style>
This will give you a centered, bolded title with continuous lines on each side.
Here's an example of the update: http://o7.no/PVXvaH
No css required
&boxh;&boxh;&boxh; Hello World &boxh;&boxh;&boxh;
Looks like this
&boxh;&boxh;&boxh;&boxh; Hello World &boxh;&boxh;&boxh;&boxh;
try this. but not compatible for all browser versions.
p:before,p:after {
content: "---";
}
<p>Hello WOrld</p>
I achieved this using div's. check this link to see the result.
HTML
<div class="line"></div>
<div class="text">Hello WOrld</div>
<div class="line"></div>
CSS
.line
{
width:100px;background-color:black;
border: 0.1em solid black; /* dashed, groove, inset */
margin-top:0.45em;margin-bottom:0.45em;
}
.line, .text
{
float:left;
}
.text
{
padding-left:10px;padding-right:10px;
}
Remember that when you add the scales(height) of margin-top, margin-bottom and border, it should be equal to one. Like 0.45 + 0.45 + 0.1 = 1 in my example. This will keep layout clean.
If you want to make the lines more bold then just increase the scale of border keeping in mind about the scales of margin-top and margin-bottom.
Hello World
p {
text-align:center;
border-left: 50px solid #363454;
border-right: 50px solid #363454;
width:150px;
line-height: 2px;
}
<p>Hello World</p>

How to merge HTML input box and a button? (sample images attached)

Please answer the following questions:
How to merge search box and search button as shown in below example1 and example2? The box and button are joined together.
How to put 'magnifier' icon on the left side of the search box?
How to put a default text into the box like 'Search for items' and fade it when user clicks on the box.
Example1
Example2
Example3 (I don't want a separate button as shown below)
Please help! Thanks!!
Easiest way is to make the entire text field wrapper, from the icon on the left to the button on the right, one div, one image.
Then put a textfield inside that wrapper with a margin-left of like 30px;
Then put a div inside the wrapper positioned to the right and add a click listener to it.
HTML:
<div id="search_wrapper">
<input type="text" id="search_field" name="search" value="Search items..." />
<div id="search_button"></div>
</div>
CSS:
#search_wrapper{
background-image:url('/path/to/your/sprite.gif');
width:400px;
height:40px;
position:relative;
}
#search_field {
margin-left:40px;
background-transparent;
height:40px;
width:250px;
}
#search_button {
position:absolute;
top:0;
right:0;
width:80px;
height:40px;
}
JQuery:
$(function(){
// Click to submit search form
$('#search_button').click(function(){
//submit form here
});
// Fade out default text
$('#search_field').focus(function(){
if($(this).val() == 'Search items...')
{
$(this).animate({
opacity:0
},200,function(){
$(this).val('').css('opacity',1);
});
}
});
});
For your first question, there are many ways to accomplish the joining of the button to the search box.
The easiest is to simply float both elements to the left:
HTML:
<div class="wrapper">
<input placeholder="Search items..."/>
<button>Search</button>
</div>
CSS:
input,
button {
float: left;
}
Fiddle
This method has some limitations, however, such as if you want the search box to have a percentage-based width.
In those cases, we can overlay the button onto the search box using absolute positioning.
.wrapper {
position: relative;
width: 75%;
}
input {
float: left;
box-sizing: border-box;
padding-right: 80px;
width: 100%;
}
button {
position: absolute;
top: 0;
right: 0;
width: 80px;
}
Fiddle
The limitation here is that the button has to be a specific width.
Probably the best solution is to use the new flexbox model. But you may have some browser support issues.
.wrapper {
display: flex;
width: 75%;
}
input {
flex-grow: 2;
}
Fiddle
For your second question (adding the magnifier icon), I would just add it as a background image on the search box.
input {
padding-left: 30px;
background: url(magnifier.png) 5px 50% no-repeat;
}
You could also play around with icon fonts and ::before pseudo-content, but you'll likely have to deal with browser inconsistencies.
For your third question (adding placeholder text), just use the placeholder attribute. If you need to support older browsers, you'll need to use a JavaScript polyfill for it.
It's all in the CSS... You want something like this:
http://www.red-team-design.com/how-to-create-a-cool-and-usable-css3-search-box
Also, for the search icon:
http://zenverse.net/create-a-fancy-search-box-using-css/
Src: Quick Google.
You don't merge them, rather you give the illusion that you have. This is just CSS. Kill the search box borders, throw it all into a span with a white background and then put the fancy little dot barrier between the two things. Then toss in some border radius and you are in business.
The above tut might look too lengthy. The basic idea is this:
Arrange the input box just like you do. The input text box should be followed by the button. add the following css to do that.
position:relative;
top:-{height of your text box}px;
or you can use absolute positioning.
<div id="search_wrapper">
<input type="text" id="search_field" name="search" placeholder="Search items..." />
<div id="search_button">search</div>
</div>
#search_wrapper{
background-color:white;
position:relative;
border: 1px solid black;
width:400px;
}
#search_field {
background-transparent;
border-style: none;
width: 350px;
}
#search_button {
position:absolute;
display: inline;
border: 1px solid black;
text-align: center;
top:0;
right:0;
width:50px;
}
http://jsfiddle.net/zxcrmyyt/
This is pretty much easy if You use bootstrap with custom css
My output is diffrent but the logic works as it is..
I have used Bootstrap 5 here you can also achieve this by using Pure CSS,
<div class="container my-5">
<div class="row justify-content-center">
<div class="col-10 p-0 inputField text-center">
<input type="text" id="cityName"placeholder="Enter your City name..">
<input type="submit" value="search" id="submitBtn">
</div>
</div>
</div>
For Styling
#import url('https://fonts.googleapis.com/css2?family=Ubuntu&display=swap');
* {
font-family: 'Ubuntu', sans-serif;
}
.inputField {
position: relative;
width: 80%;
}
#cityName {
width: 100%;
background: #212529;
padding: 15px 20px;
color: white;
border-radius: 25px;
outline: none;
border: none;
}
#submitBtn {
position: absolute;
right: 6px;
top: 5px;
padding: 10px 20px;
background: rgb(0, 162, 255);
color: white;
border-radius: 40px;
border: none;
}
Hear is an Example !
https://i.stack.imgur.com/ieBEF.jpg

Display a round percent indicator with CSS only

Hi all !
I want to create a small round static percent indicator in CSS but I can't find the solution.
The squared indicator at left is ok, but so ugly, I want it round !
I have tried with rounded corner (cf indicators at the right of the screenshot), and I wonder if there is possibility to add a rounded mask to hide the corners (cf. css3 mask : http://webkit.org/blog/181/css-masks/), but it seems like it's only for img...
The solution can works only on webkit browsers, because it's for a mobile webapp.
Here is my code to create the (ugly) indicator in the image above :
<div class="meter-wrap">
<div class="meter-value" style="background-color: #489d41; width: 70%;">
<div class="meter-text"> 70 % </div>
</div>
</div>
And the css :
.meter-wrap{
position: relative;
}
.meter-value {
background-color: #489d41;
}
.meter-wrap, .meter-value, .meter-text {
width: 30px; height: 30px;
/* Attempt to round the corner : (indicators at the right of the screenshot)
-webkit-border-radius : 15px;*/
}
.meter-wrap, .meter-value {
background: #bdbdbd top left no-repeat;
}
.meter-text {
position: absolute;
top:0; left:0;
padding-top: 2px;
color: #000;
text-align: center;
width: 100%;
font-size: 40%;
text-shadow: #fffeff 1px 1px 0;
}
Add a wrapper around your .meter-value class, set its overflow to hidden and then set the width of that layer to get the desired effect. The rounded corners on the .meter-value class should remain intact and give you a nice fluid progress indicator.
You will have to move the .meter-text div outside of the wrapper to ensure it's visible throughout the transition, so your html would like something like:
<div class="meter-wrap">
<div class="meter-text"> 70 % </div>
<div class="meter-value-wrapper" style="width:70%;">
<div class="meter-value" style="background-color: #489d41;">
</div>
</div>
And the class for .meter-value-wrapper might look like:
.meter-value-wrapper {
overflow: hidden;
width: 30px;
height: 30px;
}