I have this element:
.container {
font-size: 14px;
line-height: 20px;
font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.link {
color: #3072c4;
cursor: pointer;
}
.counter {
display: inline-block;
min-width: 9px;
padding: 0 4px;
text-align: center;
line-height: 17px;
background: #FF8000;
color: #fff;
font-size: 12px;
font-weight: 700;
border-radius: 17px;
}
<span class="container">
<span class="link">
Feedback
</span>
<span class="counter">166</span>
</span>
Its height must be 17px, horizontal padding should be 4px and font size should be 12px. It looks like a prototype in Chrome and Firefox:
But there is a problem in Internet Explorer:
It lowers the text inside, it is not well aligned vertically. If I set line-height and width of element to 18px (as well as every other even value), everything is OK, but I need 17px. How to avoid text lowering in IE?
You can add a specific style for IE. You can try this:
.container {
font-size: 14px;
line-height: 20px;
font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.link {
color: #3072c4;
cursor: pointer;
}
.counter {
display: inline-block;
min-width: 9px;
padding: 0 4px;
text-align: center;
line-height: 17px;
background: #FF8000;
color: #fff;
font-size: 12px;
font-weight: 700;
border-radius: 17px;
}
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE Edge 12+ CSS styles go here */
.counter {
display: inline-block;
min-width: 9px;
padding: 0px 4px 1px 4px;
text-align: center;
line-height: 17px;
background: #FF8000;
color: #fff;
font-size: 12px;
font-weight: 700;
border-radius: 17px;
}
}
<span class="container">
<span class="link">
Feedback
</span>
<span class="counter">166</span>
</span>
Related
I have a button which displays a bottom border when hovering over it.
I want to reduce the length of the bottom border using CSS without changing the interactable size of the button. (Imagine the purple border only stretching to the length of the word) My current CSS is:
.storybook-button {
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 700;
border: 0;
cursor: pointer;
display: inline-block;
line-height: 1;
padding: 15px 25px;
color: #333;
background-color: transparent;
border-bottom: 5px solid blueviolet;
}
<div class="storybook-button">Button</div>
Any help would be appreciated!
Use background instead of border.
.storybook-button {
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 700;
border: 0;
cursor: pointer;
display: inline-block;
line-height: 1;
padding: 15px 25px;
color: #333;
background-color: transparent;
background: linear-gradient(blueviolet 0 0) center bottom / 100% 5px no-repeat;
transition: 0.3s linear;
}
.storybook-button:hover {
/* border-width border-height */
background-size: 50% 5px;
}
<div class="storybook-button">Button</div>
I am trying to make a horizontal card across part of the screen and so far everything looks exactly the way I want except the image only display partially in the card border, about halfway, and the covers the next card. I am trying to get it to sit evenly within the card. I have included a photo of what I mean and this is the code I am using. Please let me know if you need to see the html.
Edit: I added the html
.cardcontainer {
border: white solid 1px;
padding-left: 30px;
padding-bottom: 30px;
margin: 20px;
background-color: rgb(7, 16, 31);
}
.cardheading {
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
color: white;
position: relative;
}
.cardpara {
font-family: Arial, Helvetica, sans-serif;
color: rgb(117, 117, 117);
position: relative;
padding-bottom: 25px;
padding-right: 25px;
font-style: italic;
width: auto;
}
.cardimg {
width: 130px;
height: 130px;
float: right;
padding:0;
margin-right: 30px;
}
.learnmorebutton {
border: none;
color: white;
padding: 10px 15px;
text-align: center;
font-size: 16px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
cursor: pointer;
margin: 0 auto;
border-radius: 15px;
animation: fade 10s linear infinite alternate;
text-decoration: none;
}
html:
<div class="cardcontainer">
<h1 class="cardheading">placeholder<i class="location">placeholder</i></h1>
<p class="cardpara">placeholder</p>
<a class="learnmorebutton" href="#" target="_blank">Learn More</a>
<img class="cardimg" src="#">
</div>
The basic answer to your question, is that you need to clear the float on the image by adding the overflow property to the parent. However, the content within .cardpara is going to push the image down. Not sure if that's what you want.
If you want the image next to the content in <p> and text to wrap around it, then move your <img> tag before <p> in the markup.
.cardcontainer {
border: white solid 1px;
padding-left: 30px;
padding-bottom: 30px;
margin: 20px;
background-color: rgb(7, 16, 31);
overflow: auto;
}
.cardheading {
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
color: white;
position: relative;
}
.cardpara {
font-family: Arial, Helvetica, sans-serif;
color: rgb(117, 117, 117);
position: relative;
padding-bottom: 25px;
padding-right: 25px;
font-style: italic;
width: auto;
}
.cardimg {
width: 130px;
height: 130px;
float: right;
padding:0;
margin-right: 30px;
}
.learnmorebutton {
border: none;
color: white;
padding: 10px 15px;
text-align: center;
font-size: 16px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
cursor: pointer;
margin: 0 auto;
border-radius: 15px;
animation: fade 10s linear infinite alternate;
text-decoration: none;
}
<div class="cardcontainer">
<h1 class="cardheading">placeholder<i class="location">placeholder</i></h1>
<p class="cardpara">placeholder</p>
<a class="learnmorebutton" href="#" target="_blank">Learn More</a>
<img class="cardimg" src="https://via.placeholder.com/130?text=PLACEHOLDER">
</div>
I managed to fix it, I used overflow:auto then I put the <img> before the <p> and changed it to the <span> element, then played around with the padding and line breaks and managed to get my resault. Thanks EternalHour :)
My code is quite simple:
<div class="mail-header-title">
${title}
</div>
<div class="mail-header-down-rounded-triangle">
<img src="fill-1#3x.png"/>
</div>
.mail-header-title {
padding: 24px 50px 36px 50px;
width: 591px;
font-family: Arial, sans-serif;
font-size: 42px;
font-weight: bold;
font-stretch: normal;
font-style: normal;
line-height: 1.29;
letter-spacing: normal;
color: #ffffff;
}
.mail-header-content {
padding: 13px 50px 16px 50px;
font-family: Arial, sans-serif;
font-size: 20px;
font-weight: normal;
font-stretch: normal;
font-style: normal;
line-height: 1.56;
letter-spacing: normal;
color: #444560;
background-color: #FFFFFF;
border: none !important;
}
.mail-header-down-rounded-triangle {
background-color: #FFFFFF;
text-align: center;
border: 0;
padding-top: 0;
}
.mail-header-down-rounded-triangle img {
height: 24px;
width: 101px;
/*content: url("fill-1#3x.png");*/
}
The first div background is blue, and the second div contains this image below.
I'm sure I set div border as none.
When the page is rendered, everything looks ok. But when I zoom in/out,
this blue line appears.
I'm not sure what happened, any idea about this?
I have a button for my page that I'm also styling it
<button id="logButton" >Iniciar sesión</button>
And then the css code
#logButton
{
width:119px;
margin-bottom: 5px;
padding-top: 3px;
margin-left:35%;
height: 25.5333px;
font-weight: bold;
font-size: 13px;
font-family: helvetica, arial, sans-serif;
}
Here's a fiddle also.
If I add the bootstrap class btn it doesn't do that and neither the font size nor the width of the button changes, my question is what does bootstrap do to keep text in place?
It's a natural behavior of an element, with fixed height and width, content will always overflow,it's better to use min-width and min-height.
#logButton
{
min-width:119px;
margin-bottom: 5px;
padding-top: 3px;
margin-left:35%;
min-height: 25.5333px;
font-weight: bold;
font-size: 13px;
font-family: helvetica, arial, sans-serif;
}
<button id="logButton" >Iniciar sesión Iniciar sesión</button>
and If you want to know about bootstrap's .btn here is css:
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
#logButton
{
/* Removed height & width*/
padding: 10px 20px; /* Added */
margin-bottom: 5px;
margin-left:35%;
font-weight: bold;
font-size: 31px;
font-family: helvetica, arial, sans-serif;
}
Don't hardcode a width. Using padding on the left and right sides. Here you go.
#logButton
{
padding: 3px 15px 0 15px;
margin-bottom: 5px;
margin-left:35%;
height: 25.5333px;
font-weight: bold;
font-size: 13px;
font-family: helvetica, arial, sans-serif;
}
if you want to hide overflow of text then use {overflow:hidden} is css code.
if you want to keep text but not want to increase with then use {height:auto}
I need help figuring out why it is when I add a link in this code that it is altering my entire div block.
This is what the page looks like:
As soon as I make the text a link, it adds about 8px to the bottom (notice how the image is smaller than the div block).
What can I do to make this look like all of my other blocks?
Update: I believe I found the code that is causing the problem, it is in the CSS of the body. There is a style that has line-height at line-height: 1.625; - when I delete this, it fixes the issue. But now I am wondering how can I remove this code for my page, without effecting the rest of the site?
Here is the problem CSS:
body {
color: #3B3F42;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1em;
line-height: 1.625;
}
And here is the rest of the coding
.ratingWrapTopRated {
background: #fff;
width: 100% !important;
height: 90px !important;
margin: 0 auto;
display: table;
font-family: Helvetica, Arial, sans-serif;
margin-bottom: 10px;
}
.cigarImage {
background: #fff;
color: #fff;
display: table-cell;
line-height: 0;
width: 90px;
padding-right: 4px;
}
.cigarName {
background: #ff5100;
color: #fff;
text-align: center;
display: table-cell;
vertical-align: middle;
word-spacing: 6px;
text-transform: uppercase;
font-size: 1.2em;
padding: 0px 3px 0px 3px;
}
.numericalScoreTopCigars {
background: #000;
color: #fff;
text-align: center;
width: 25%;
display: table-cell;
font-size: 4.9em;
letter-spacing: 3px;
vertical-align: middle;
font-weight: bold;
border-left: 4px solid;
border-color: #fff;
line-height: 0;
}
a.ratingsLink:link {
text-decoration: none;
background: #ff5100;
color: #fff;
text-align: center;
vertical-align: middle;
word-spacing: 6px;
text-transform: uppercase;
font-size: 1em;
padding: 0px 3px 0px 3px;
}
<span class="ratingWrapTopRated">
<span class="cigarImage hidebuttons"><img class="alignnone size-thumbnail wp-image-2352" src="http://cigardojo.com/wp-content/uploads/2012/08/padron-serie-1926-150x150.jpg" alt="Padron Serie 1926 No. 9 Maduro" width="150" height="150" /></span>
<span class="cigarName shortenText"><a class="ratingsLink" href="http://cigardojo.com/?p=1019">Fuente Fuente OpusX XXX Belicoso</a></span>
<span class="numericalScoreTopCigars">96</span>
</span>