width-transition not working on ::after in FF - css

I have this menu that I want to try some new animation with on the hover state. The problem is that the width transition doesn't seem to work in Firefox, but in Chrome, Safari and IE. I've tried with both Bourbon mixin and without, no help. Is Firefox not capable of having CSS transitions on pseudo elements or what could cause the problem?
Codepen
http://codepen.io/stroperik/pen/ByJjmR
HTML
<ul>
<li><span>Hem</span></li>
<li><span>Tjänster</span></li>
</ul>
SCSS
ul {
list-style-type: none;
}
li {
display: inline-block;
cursor: pointer;
margin: 0 10px;
}
span {
text-transform: uppercase;
font-family: 'Arial';
font-size: 48px;
font-weight: bold;
}
span::after {
display: block;
content: '';
width: 2px;
height: 5px;
background: red;
#include transition(width 0.2s ease);
}
span:hover::after {
width: 100%;
}
Thanks in advance

Looks like Firefox quirk (?), but apparently it needs pseudo-element :after to be positioned in this case:
span {
text-transform: uppercase;
font-family: 'Arial';
font-size: 48px;
font-weight: bold;
position: relative;
}
span:after {
position: absolute;
bottom: 0;
left: 0;
display: block;
content: '';
width: 2px;
height: 5px;
background: red;
#include transition(width 0.2s ease);
}
I will also add that setting a "border" like this would ideally anyway require positioning of :after relatively to its parent span because it allows setting necessary offset easy.
Demo: http://codepen.io/anon/pen/yypeEx

Related

CSS Content property does not work on safari

I have and element and on hover it has an arrow appearing.
The problem is that it works on chrome and firefox but does not work on safari 12. It works on safari 10 though.
So far I found out that the problem is content:url('../path/to/arrow.png')
If I replace path to the arrow with content: '1234' then it works for some reason.
here is a full code
<style>
.textwidget a {
border-radius: 0;
background-color: none;
color: #fff;
text-align: center;
font-size: 10px;
text-transform: uppercase;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin-top: 101px;
margin-bottom: 94px;
margin-left: -10px;
}
.textwidget a {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.textwidget a:after {
font-family: "Font Awesome 5 Free" !important;
content: url(../public/assets/images/icons/arrow-right-small-white.png) !important;
font-weight: 600 !important;
position: absolute;
opacity: 0;
top: 3px;
right: 23px;
transition: 0.5s;
}
.textwidget a:hover{
padding-right: 24px;
padding-left:3px;
}
.textwidget a:hover:after {
opacity: 1;
right: 10px;
}
</style>
<div class="textwidget">
<p>
Link
</p>
</div>
So my desired output is that content: url(../public/assets/images/icons/arrow-right-small-white.png)
works also on safari 12
Try mount the arrow on span element instead and do it like in docs, so without content property

Underline long url

On mobile devices with a width < 400px underlined links with long text breaks in two lines and just the second line will be underline.
How can i solve this problem.
CSS code:
a {
position: relative;
display: inline-block;
cursor: pointer;
color: #1a1a1a;
text-decoration: none;
}
a:after {
position: absolute;
content: "";
left: 50%;
transform: translateX(-50%);
bottom: 0;
width: calc(100% - 5px);
min-height: 2px;
height: .15em;
background: #1a1a1a;
transition: all .15s cubic-bezier(.25,.46,.45,.94);
}
a:hover:after {
width: 105%;
}
With this you have removed the text underline
text-decoration: none;
And then you replace it with a line in a a:after, this is how this is expected to work and if you want to revert it remove the text-decoration and a:after block.
It is because you converted <a> to inline block element. just remove that display: inline-block; applied to <a> and it will work.
By default <a> tags are inline elements. So there is no need of applying display: inline-block for . But in case from some where <a> tag is inheriting some other display properties, the you have to apply/overwrite display: inline to your <a> element.
Allthough I would recommend using the text-decoration property as mentioned in previous answers, you may wrap the links content in an inline element and apply some margin/padding to use the border bottom property. Then you may animate the underline in one or more lines.
div {
width: 210px;
}
a {
position: relative;
display: inline-block;
cursor: pointer;
color: #1a1a1a;
text-decoration: none;
padding-left: 10px;
padding-right: 10px;
width: 100%;
margin-bottom: 20px;
}
span {
box-sizing: content-box;
position: relative;
left: 0;
border-bottom: 3px solid #1a1a1a;
transition: all .15s cubic-bezier(.25, .46, .45, .94);
}
a:hover span {
margin: 0 -10px;
padding: 0 10px;
border-bottom-color: navy;
}
<div>
<span>Short link</span>
<span>Really long link text here that breaks into 2 lines</span>
</div>

CSS dotted elements effect

I've setup a list where each list element contains two container: a title and a description container. What I need is to show dots at the bottom of each line.
It's working fine in Chrome and Safari. But unfortunately it doesn't work in firefox.
jsfiddle
Any suggestions on how to make this also work in firefox?
ul.basic {
display: table;
overflow: hidden;
}
ul.basic li {
position: relative;
display: table-row;
}
ul.basic li .title, ul.basic li .description {
display: table-cell;
background-color: #fff;
}
ul.basic li .title {
color: #999;
position: relative;
overflow: hidden;
padding-right: 60px;
}
ul.basic li .title span {
position: relative;
z-index: 10;
background-color: #fff;
}
ul.basic li .title:after {
content: '....................................................................... .......................................................................................................................................... ....................................................................................................................................... .............................................................................................................................................................................................';
position: absolute;
width: 300%;
margin-left: -100%;
word-wrap: break-word;
}
ul.basic li .description {
padding-left: 2px;
color: #000;
}
I see 2 behaviour really different between FF and CHrome. Aniway why don't just use a
border-bottom: 1px dotted;
as css rule for css .description ? (also for .title if you need)
I had to use an image to display the desired result properly in all browsers.

Scale size of font icon when hovering over div, using only css?

I'm trying to make a div in which the size of a font icon scales when hovering over an entire div, not just the specific icon. Something similar to: http://fortawesome.github.io/Font-Awesome/icons/ To clarify, hovering over a <li> item causes a the specific icon to scale, but not the rest. I know how to cause it to change size upon mouseover of the icon itself, but I need it to scale when hovering over the rest of the div.
I'm wondering if this is possible to do simply through CSS, no jQuery/javascript, maybe through some selectors I don't know too well? Thanks in advance.
Quickest example I could think of...
<h1><span>★</span>your text?</h1>
Something like this...
h1 {
display: inline-block;
vertical-align: middle;
font-size: 1rem;
line-height: 1.8em;
border: 1px solid red;
padding: 1em;
}
h1 span {
display: inline-block;
vertical-align: middle;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
Think about it from right to left:
h1:hover h1 span {
font-size: 3em;
}
"any span within an h1 , while h1: is hovered over -> do this... "
ROUND 2: this should spell it out.
HTML
<ul class="icon-list">
<li>
<a href="#">
<div class="your-icon">☃</div>
Some text that doesn't move.
</a>
</li>
</ul>
CSS
.icon-list {
list-style: none;
padding: 0;
}
.icon-list li a {
display: inline-block;
height: 2em;
line-height: 2em;
text-decoration: none;
padding: 0 .5em;
color: #111;
-webkit-border-radius: 1em;
border-radius: 1em;
}
.icon-list li a:hover {
background-color: rgba(255,0,0,.1);
}
.icon-list li a .your-icon {
display: inline-block;
float: left;
width: 32px;
height: 32px;
text-align: center;
}
.icon-list li a:hover .your-icon {
font-size: 28px;
}
If you want it to scale when hovering over the div, you just use the hover selector on the div itself. Add a class to the div like .font-hover then in your css:
.font-hover:hover {
font-size: 12px;
}
Obviously setting the font-size to whatever you want.
See this fiddle
CSS
div {
padding: 3px 5px;
}
div,span {
transition: font-size .7s;
}
span {
display: inline-block;
width: 45px;
vertical-align: middle;
}
div:hover span{
font-size: 23px;
}
HTML
<div><span>OK,</span> Let's get bigger.</div>

CSS - Unable to get input text and a link on the same line

All-
Googled this and tried for about 20 minutes but just can't seem to figure this out. Does anyone know why I can't get the Search: to be on the same line?
I've tried the display: inline, display: block, float:left/right, clear:both, but to no avail. Even w/chrome inspector I can't figure out why it isn't working properly.
Edit: Pasting relevent code
<li>Search: <input type="text" name="quest_search"></li>
Corresponding css:
header {
background: #f6f6f6;
height: 58px;
border-bottom: 1px solid #eaeaea;
margin-bottom: 60px;
}
/* Social Links */
header aside ul {
padding-top: 18px;
}
/* Main Navigation */
header .select-menu { display: none; }
header nav { position: relative; }
header nav ul {
list-style: none;
float: right;
padding: 22px 0px 0px 0px;
}
header nav ul li {
float: left;
margin-left: 30px;
position: relative;
}
header nav ul li a{
color: #b5b5b5;
font-size: 12px;
-webkit-transition:color 0.2s ease-in;
-moz-transition:color 0.2s ease-in;
-o-transition:color 0.2s ease-in;
transition:color 0.2s ease-in;
}
header nav ul li a:hover { color: #777; }
header nav ul li.current a{ color: #555; font-weight: bold; }
header nav span.arrow {
width: 24px;
height: 13px;
background: url('../images/light-nav_arrow.png') no-repeat;
display: none;
position: absolute;
top: 58px;
}
http://dump.tanaris4.com/so/cfs.html
Thanks in advance!
Your issue is that the input in base.css has a a width of 100%. This means that the width of the input will always be 100% of the size of its parent element, which also contains the "search: " text. Change this to something less than 100% and it should work fine.
For example:
input[type="password"], input[type="text"], input[type="email"] {
width: 50%;
}
Of course, width:50% is just one example of what you can use. width:auto and other specific widths will work. Just play around with it and see what works best for you.
Your base.css file is giving the input a width: 100%;. Try giving it a width: auto
CSS:
input[name="quest_search"]{
width: auto;
}
Just put "Search:" in it's own <li> is a simple quick fix.

Resources