I am trying to increase the space between the image and text in this link top bar.
Link: https://pushdaddy2.myshopify.com/
I tried which is normal to use for increasing the whitespace but it just prints the character.
<span id="pab_message" style="color:inherit;"> All t-shirts are 15% off </span>
Can anyone say is there any criteria to use ?
Here is the complete html:
<div id="pab_bar" style="text-align: center; margin: 0px; padding: 4px 10px;
left: 0px; height: auto; width: 100%; box-sizing: border-box; border: none;
background-color: rgb(34, 34, 34); color: rgb(255, 246, 169); font-size: 20px;
line-height: 25px; font-family: Sacramento;">
<div id="pab_content" style="text-align:center; display: inline-block;">
<img src="https://img.pngio.com/truck-icon-myiconfinder-png-of-transportation-vehicles-256_256.png"
width="30" style="vertical-align:middle">
<span id="pab_message" style="color:inherit;">All t-shirts are 15% off </span>
<img src="" width="30" style="vertical-align:middle">
<span style="display:inline-block;">
<a id="pab_button" style="outline: none; border: none; line-height: 2em;
padding: 0px 1em; margin: 0px 0px 0px 1em; display: inline-block;
border-radius: 0.25em; cursor: pointer; width: auto;
height: inherit; font-family: inherit; font-size: 0.875em;
text-align: center; text-decoration: none;
-webkit-appearance: none; color: rgb(255, 246, 169);
background-color: rgb(0, 0, 0);" type="button" href="#"
onclick="pab_button_on_click(event)">Check the product</a>
</span>
</div>
</div>
"I tried which is normal to use for increasing the whitespace but it just prints the character."
No it's not, that's what padding is for.
#pab_message {
padding-left: 2rem;
}
<div id="pab_bar" style="text-align: center; margin: 0px; padding: 4px 10px; left: 0px; height: auto; width: 100%; box-sizing: border-box; border: none; background-color: rgb(34, 34, 34); color: rgb(255, 246, 169); font-size: 20px; line-height: 25px; font-family: Sacramento;">
<div id="pab_content" style="text-align:center; display: inline-block;"><img src="https://img.pngio.com/truck-icon-myiconfinder-png-of-transportation-vehicles-256_256.png" width="30" style="vertical-align:middle"> <span id="pab_message" style="color:inherit;">All t-shirts are 15% off </span><img src="" width="30" style="vertical-align:middle"> <span style="display:inline-block;"><a id="pab_button" style="outline: none; border: none; line-height: 2em; padding: 0px 1em; margin: 0px 0px 0px 1em; display: inline-block; border-radius: 0.25em; cursor: pointer; width: auto; height: inherit; font-family: inherit; font-size: 0.875em; text-align: center; text-decoration: none; -webkit-appearance: none; color: rgb(255, 246, 169); background-color: rgb(0, 0, 0);" type="button" href="#" onclick="pab_button_on_click(event)">Check the product</a></span></div>
</div>
Continuing #Paulie_D's answer. And your comment. If you want manual spaces just use inline spacing with different padding values.
<span id="pab_message" style="color:inherit; padding-left: 10px;">All t-shirts are 15% off </span>
<span id="pab_message" style="color:inherit; padding-left: 15px;">All t-shirts are 15% off </span>
<span id="pab_message" style="color:inherit; padding-left:20px;">All t-shirts are 15% off </span>
AND to your answer that why non breaking space doesn't work at the beginning of the sentence you can look at:
https://stackoverflow.com/a/12279649/9357872
or read this from https://www.w3schools.com/html/html_entities.asp:
Non-breaking Space
A common character entity used in HTML is the non-breaking space:
A non-breaking space is a space that will not break into a new line.
Two words separated by a non-breaking space will stick together (not
break into a new line). This is handy when breaking the words might be
disruptive.
Examples:
§ 10
10 km/h
10 PM
Another common use of the non-breaking space is to prevent browsers
from truncating spaces in HTML pages.
If you write 10 spaces in your text, the browser will remove 9 of
them. To add real spaces to your text, you can use the
character entity.
Related
I'm new to html and css, but I'm trying to teach myself how to make a decent looking website. I've gotten to the footer portion of the website and I thought I created well since it looked as I wanted, but when I zoomed into the page, the elements in the footer all began overlapping with one another. Could someone help me out by showing me how to fix this issue. Any help is appreciated.
My current footer:
.footer {
background: #323132;
text-transform: uppercase;
width: 100%;
height: 350px;
color: white;
}
.footer a {
text-decoration: none;
color: #a2a4a7;
font-family: Arial,sans-serif;
font-size: 14px;
}
.vertical-right-1 {
border-right: 2px solid black;
height: 200px;
position: absolute;
margin: 15px 0;
left: 20%;
box-shadow: 0.2px 0.2px;
}
.vertical-right-2 {
border-right: 2px solid black;
height: 200px;
position: absolute;
margin: 15px 0;
left: 45%;
box-shadow: 0.2px 0.2px;
}
.vertical-right-3 {
border-right: 2px solid black;
height: 200px;
position: absolute;
margin: 15px 0;
left: 70%;
box-shadow: 0.2px 0.2px;
}
<div class="footer">
<div style="float: left; margin: 0 auto; padding: 10px 0 0 40px;">
<p><strong>Find a Store</strong></p>
<p><strong>Sign Up For Email</strong></p>
<p><strong>Become A Member</strong></p>
<p><strong>Site Feedback</strong></p>
</div>
<div class="vertical-right-1">
</div>
<div style="float:right; margin: 0 auto; width: 300px;">
<p style="font-family: 'Cabin Condensed', sans-serif;font-size: 20px;">Need To Talk?</p>
<p>Order Status</p>
<p>Shipping and Delivery</p>
<p>Returns</p>
<p>Payment Options</p>
<p>Contact Us</p>
</div>
<div class="vertical-right-2">
</div>
<div style="float:right; margin: 0 auto; width: 330px;">
<p style="font-family: 'Cabin Condensed', sans-serif;font-size: 20px;"><strong>Sports</strong></p>
<p>Soccer</p>
<p>Basketball</p>
<p>NFL</p>
<p>Tennis</p>
</div>
<div class="vertical-right-3">
</div>
<div style="margin:0 auto; width:630px; padding:4px 0 0 0;">
<strong>
<p style="font-family: 'Cabin Condensed', sans-serif; font-size: 20px;">About The League</p>
</strong>
<p>News</p>
<p>Careers</p>
<p>Investors</p>
<p>Sustainability</p>
</div>
<div style="margin: 30px; color: white;"><br>
<hr>
</hr>
</div>
<a href="#"><i class="fa fa-facebook"
style="padding: 25px;font-size: 30px; width: 80px; text-align: center; text-decoration: none; border-radius: 50%;"></i></a>
<!-- <a href="#"><i class="fa fa-twitter"
style="padding: 2px;font-size: 30px; width: 30px; text-align: center; text-decoration: none; border-radius: 50%;"></i></a>
<a href="#"><i class="fa fa-instagram"
style="padding: 2px;font-size: 30px; width: 30px; text-align: center; text-decoration: none; border-radius: 50%;"></i></a> -->
</div>
As you can see, the lines are all overlapped, and it looks just wrong. If you view it in full screen mode it looks as it should.
Hope someone can lend a hand!
You're going to want to set up some breakpoints which will allow you to alter CSS for different screen sizes.
Also, I wouldn't use absolute and left to position elements on a page, unless in particular circumstances. What you want to do instead is use grid or flexbox, it will make life much easier in the future.
I have the situation that I can only use inline CSS because otherwise our Wordpress Theme gets all messed up. I build this little div that is suppose to be a conversion element on our articles. I now need to get it responsive for mobile devices.
all help is appreciated :)
Thats the code I have:
<div style="width: 560px; height: 171px; padding: 32px 32px 0px 32px; box-shadow: 0 0.063rem 0.188rem rgba(0,0,0,0.2), 0 0.125rem 0.125rem rgba(0,0,0,0.12), 0 0 0.125rem rgba(0,0,0,0.14);">
<div>
<h2 style="font-family: 'Circular TT', Helvetica, sans-serif; font-weight: 700px; margin: 0px; color: #003264;">Ist Ihnen das Preis-Leistungsverhältnis für Ihren Zahnschutz wichtig?</h2>
</div>
<div style="margin-top: 32px; display: block; text-align: center;">
<button onclick="window.location.href = ;" type="submit" style="display: inline-block; color: #32ff96; background-color: #003264; border: 0.125rem solid #003264; font-family: Circular TT, Arial, Helvetica, sans-serif; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; position: relative; width: calc(50% - 15px); padding: .625rem 1.37rem;">Ja</button>
<button onclick="window.location.href = ;" type="submit" style="display: inline-block; color: #32ff96; background-color: #003264; border: 0.125rem solid #003264; font-family: Circular TT, Arial, Helvetica, sans-serif; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; position: relative; width: calc(50% - 15px); padding: .625rem 1.37rem; margin-left: 20px;">Nein</button>
</div>
</div>
To make your div responsive:
Use a dynamic width value like % or vh that adjusts automatically to the screen size.
Use auto value with the height property to adjust automatically to the div content, because the content would get longer on a narrow screen.
you can also set a max-width to limit the div width on a large screen.
<div style="width: 95%; max-width: 560px; height: auto; min-height: 171px;">
Don't hesitate to reach me out for further assistance if needed.
Simple question:
Can I make the underline using border-bottom (the ones on the right side) look exactly like the ones using box-shadow (the ones on the left side)?
I need it to be CSS only. And it may span across multiple lines as you can see from the snippet.
Basically I need to move the border-bottom a little bit up and not mess with everything else.
#import url('https://fonts.googleapis.com/css?family=Proxima+Nova');
div.flex {
display: flex;
width: 420px;
justify-content: space-between;
}
div.flex2 {
display: flex;
width: 300px;
justify-content: space-between;
}
h2 {
font-family: 'Proxima Nova';
color: rgb(60,128,124);
font-size: 21px;
font-weight: bold;
margin-top: 20px;
margin-bottom: 10px;
}
a.boxShadow {
color: darkGrey;
text-decoration: none;
line-height: 26px;
box-shadow: inset 0 -2px white, inset 0 -4px 0 rgb(60,128,124);
padding-bottom: 3px;
}
a.borderBottom {
color: darkGrey;
text-decoration: none;
line-height: 26px;
border-bottom: 2px solid rgb(60,128,124);
}
<div class="flex">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>
<div class="flex2">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>
REASON FOR THIS QUESTION (BROWSER CONSISTENCY):
The box-shadow example does exactly what I want, but it does not look good on Edge (and I'm afraid other browsers might not render it properly as well). It looks perfect on recente versions of Chrome, Firefox and Safari though.
On Edge, the box-shadow example looks like this (see small line leaking at the bottom):
On the other hand, border-bottom seems to render consistently across browsers. But I can't get the underline in the position that I need.
Gradient can do this
#import url('https://fonts.googleapis.com/css?family=Proxima+Nova');
div.flex {
display: flex;
width: 420px;
justify-content: space-between;
}
div.flex2 {
display: flex;
width: 300px;
justify-content: space-between;
}
h2 {
font-family: 'Proxima Nova';
color: rgb(60,128,124);
font-size: 21px;
font-weight: bold;
margin-top: 20px;
margin-bottom: 10px;
}
a.boxShadow {
color: darkGrey;
text-decoration: none;
line-height: 26px;
box-shadow: inset 0 -2px white, inset 0 -4px 0 rgb(60,128,124);
padding-bottom: 3px;
}
a.borderBottom {
color: darkGrey;
text-decoration: none;
line-height: 26px;
background:
linear-gradient(rgb(60,128,124),rgb(60,128,124))
bottom 1px center/ /* Position */
100% 2px /*width height*/
no-repeat;
}
<div class="flex">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>
<div class="flex2">
<h2>
<a class="boxShadow">Hello gjq box-shadow</a>
</h2>
<h2>
<a class="borderBottom">Hello border-bottom</a>
</h2>
</div>
I'm using this hover effect for buttons, but in a few cases when the height changes, the top remains the same and the bottom moves up, instead of vice versa like it should. How can I make sure it always goes in the correct direction?
jsfiddle
.button {
box-sizing: border-box;
display: inline-block;
width: 215px;
height: 55px;
color: white;
font-family: $arial;
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
text-align: center;
text-decoration: none;
text-shadow: 1px 1px 1px rgba(43, 36, 36, 0.35);
letter-spacing: .1em;
border-radius: 3px;
position: relative;
background: #009ee0;
border: 1px solid #148fc6;
border-bottom: 4px solid #148fc6;
}
.button:hover {
border-bottom: 1px;
height: 53px;
}
.button span {
position: absolute;
width: 90%;
left: 0;
right: 0;
margin: auto;
top: 50%;
transform: translateY(-43%);
line-height: 1.2;
}
div {
padding: 20px 5px;
}
<div>
<a href="#" class="button">
<span>Wrong way</span>
</a>
</div>
<div>
<a href="#" class="button">
<span>I work fine</span>
</a>
<a href="#" class="button">
<span>I work fine</span>
</a>
</div>
You're reducing the height from 55px to 53px. That 2px has to go somewhere. The top button is just collapsing it. (The bottom two are doing the same, it just doesn't look like it because they are being affected by vertical text alignment). change your hover rule to this to accommodate for the height loss.
.button:hover {
border-bottom: 1px;
margin-top: 2px;
height: 53px;
}
https://jsfiddle.net/exd6hhvz/
I was able to make it work consistently by adding margin-top: 2px; to .button:hover
Here's an example: https://jsfiddle.net/vf03czp5/
I have the following html :
<div class="pagination">
<ul id="paginationnbEnreg">
<li class="active">
<a onclick="changePageMP3('1');" title="Page 1" href="#">1</a>
</li>
</ul>
<span id="nbEnreg" class="label">55 found</span>
</div>
With the following css :
.pagination {
margin: auto;
text-align: center;
outline: medium none;
padding: 0;
position: relative;
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 12px;
line-height: 18px;
}
.label {
color: #ffffff;
display: inline-block;
font-size: 11.844px;
font-weight: bold;
line-height: 14px;
padding: 2px 4px;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
vertical-align: baseline;
white-space: nowrap;
}
My list will diplay on the left of the page while "55 found" will diplay in the center of the page.
I am trying to get my list in the middle of the page but can't get it working.
I think this is happening because you didn't remove the list-style and didn't reset the margin and padding.
Do you mean like this http://jsfiddle.net/06u4bsqn/ ?
For margin:auto your box needs a width setting. Otherwise it takes 100%.
Your ul is 100% wide as it is a block level element.
You can center it (with the span) by setting display:inline-block on the ul
.pagination {
margin: auto;
text-align: center;
outline: medium none;
padding: 0;
position: relative;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 18px;
background: plum;
}
.pagination ul {
display: inline-block;
}
.label {
color: #ffffff;
display: inline-block;
font-size: 11.844px;
font-weight: bold;
line-height: 14px;
padding: 2px 4px;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
vertical-align: baseline;
white-space: nowrap;
}
<div class="pagination">
<ul id="paginationnbEnreg">
<li class="active">
<a onclick="changePageMP3('1');" title="Page 1" href="#">1</a>
</li>
</ul>
<span id="nbEnreg" class="label">55 found</span>
</div>