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>
Related
I can't figure out how to change the icon on the li in this url.
I tried to change the content but that just gave an extra figure over the green v.
https://codepen.io/gnevin/pen/axNVex
.check-list {
margin: 0;
padding-left: 1.2rem;
}
.check-list li {
position: relative;
list-style-type: none;
padding-left: 2.5rem;
margin-bottom: 0.5rem;
}
.check-list li:before {
content: ' ';
display: block;
position: absolute;
left: 0;
top: -2px;
width: 5px;
height: 11px;
border-width: 0 2px 2px 0;
border-style: solid;
border-color: #00a8a8;
transform-origin: bottom left;
transform: rotate(45deg);
}
Here use border and transform used for rotation. If you want to change there are a few more ways. First of all, remove the border and put what you want in the content.And use List style for default styling
k.imgur.com/gwikL.png
I am using prime ng panel menu. There is black border around the active menu. I debugged the css in chrome, but I can't find the css for the border.
<div class="sidenav">
<h4 style="text-align: center">Sample App</h4>
<p-panelMenu
[model]="items"
[style]="{ width: '250px' }"
[multiple]="false"
></p-panelMenu>
</div>
.sidenav {
height: 100%;
width: 250px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #f8f9fa;
overflow-x: hidden;
}
.sidenav a {
padding: 6px 6px 6px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
}
.sidenav a:hover {
color: #f1f1f1;
}
Actually, it is not a border, but a box-shadow, that is visible when the <a> element inside .p-panelmenu-header is focused.
You can override the default CSS rule:
.p-panelmenu .p-panelmenu-header > a:focus {
box-shadow: none;
}
The nav buttons sit on top of the image title div. Both drop down on hover. When going to the next image, the nav buttons are at the correct location, but when you click on the previous, the whole nav screen shifts to the bottom right!
nav {
position: absolute;
width: 100%
height: 20px;
padding-bottom: 2px;
z-index: 1;
float: right;
margin-top: -20px;
transition: margin-top 200ms ease-in;
background: black;
opacity: 0.4;
right: 1px;
}
.title {
position: absolute;
width: 85%;
height: 20px;
padding-bottom: 2px;
margin-top: -25px;
transition: margin-top 200ms ease-in;
background: black;
color: white;
opacity: 0.6;
}
.title-text {
float: left;
padding-left: 5px;
}
.slides:hover .title {
margin-top: 0px;
}
Here is link to a fiddle.
I fixed this part but code itself is clumsy
anyway still here is example : jsfiddle
first of all you forgot ";" in .nav { between height and width
secondly dont use position: absolute and float it exclude each other
try to connect similiar classes like your buttons
.btn-prev,
.btn-next{
color: black;
background:white;
border: 2px solid white;
margin: 0px 5px 0px 0px;
cursor: pointer;
padding: 0px 5px 0px 5px;
display: inline-block;
}
Quick explain, I set text-align on .nav element so buttons would be set on right side inside .nav and .btn-* for display: inline-block; (default
display: block; so it would behave similiar like text.
I would like to reproduce the following logo, add a shadow below one letter as in the using only CSS.
How to do it as box-shadow overflow on both side of the letter ? I would prefer to avoid having an extra <span class="shadow"></span> following my "hovering" letter but manage it only with the letter tag/CSS rule (see HTML below).
N.B.: I'm aware of jQuery / CSS3 Animated shadow effect.
HTML
<span>Pr<span class="text-info">o</span>be</span>
CSS
element.style {
box-shadow: 0 4px 3px #AAAAAA;
position: relative;
top: -3px;
}
Using pseudo-elements (:before and :after), :hover and opacity properties, the solution looks like the following (it can be extended w/animation effects on opacity)
HTML
<div class="text-effects"><span>Pr<span class="text-info">o</span>be</span></div>
CSS
body {
font-size: 10em;
font-family: Arial;
}
div.text-effects {
text-transform:uppercase;
}
span.text-info {
position: relative;
cursor:pointer;
}
.text-info:hover {
color: #008080;
bottom: 0.1em;
}
span.text-info:before {
content: ".";
color: transparent;
position: absolute;
width: 40%;
box-shadow: 0 5px 4px -4px #303030;
display: block;
left: 30%;
bottom: 1em;
opacity:0;
}
span.text-info:after {
content: ".";
color: transparent;
position: absolute;
bottom: 0;
width: 40%;
box-shadow: 0 5px 4px -4px #303030;
display: block;
left: 30%;
bottom:0.15em;
opacity:0;
}
span.text-info:hover:before{
opacity:1;
}
span.text-info:hover:after{
opacity:1;
}
Technique
I had to use pseudo-element as described by #Alex Bell.
But instead of box-shadow I use text-shadow and tweak the pseudo-element position.
pseudo-element text is ˍ aka U+02CD MODIFIER LETTER LOW MACRON (ˍ or \u02CD)
Final result is available as a fiddle.
HTML
<div class="text-effects">
<span>Pr<span class="text-info">o</span>be</span>
</div>
CSS
body {
font-size: 10em;
font-family: Arial;
}
div.text-effects {
text-transform:uppercase;
}
span.text-info {
position: relative;
color: #008080;
bottom: 0.1em;
width: 1em;
height: 1em;
}
span.text-info:after {
bottom: 0.15em;
color: transparent;
content: "ˍ";
display: block;
font-size: 120px !important;
height: 1em;
left: 26%;
position: absolute;
text-shadow: 0 0 11px #999;
width: 1em;
}
I am trying to make the hidden span fade in when you hover over the image. I can't make it transition.
.thumb {
margin-top: 10px;
margin-right: -3px;
}
.thumb span {
display: none;
}
.thumb:hover span {
display: block;
position: absolute;
padding: 55px 0 0 0;
text-decoration: none;
text-align: center;
background-color: #ff6600;
opacity: .8;
width: 300px;
height: 95px;
font-size: 17px;
font-family: Candara;
text-shadow: 2px 2px 2px #000;
transition-property: opacity, background-color;
transition-duration: 25s ease-in;
}
Whats wrong with my css?
".thumb:hover span" it says, your span tag has to be child to ".thumb" class tag. But you cant put "span into image tag'. Rather you can use jquery or else put ".thumb' class to the parent of span, so that the parent hover will trigger the effect you want. You can also have a common parent to both image and span.