CSS Border/Outline With Outside Padding - html

I am trying to create a reusable div css class that I can use to highlight quotes in articles I am writing on my campaign website. When debugging in Visual Studio using Chrome (or Firefox) I get the desired result:
As you can see there is a silver border, but padding around it.
My CSS class is:
.articleQuote {
background-color: #FFFFFF;
font-family: 'PT Sans', sans-serif;
font-size: 20px;
color: navy;
padding: 25px 25px 25px 25px;
outline-style: solid;
outline-color: silver;
outline-width: 1px;
outline-offset: -10px;
text-align: center;
}
However, in Internet Explorer no padding on the border occurs. Seems like outline-offset is ignored.
Link to article on my website
How can I get a cross-browser class set up that will produce the desired result?

outline-offset is not supported in Internet Explorer.
You could use a combination of outline and border to achieve the same effect.
Here border is used for the silver line and outline is used for the white space surrounding the element.
body {
background: #fffacf;
padding: 15px;
}
.articleQuote {
background-color: #FFFFFF;
font-family: 'PT Sans', sans-serif;
font-size: 20px;
color: navy;
padding: 25px 25px 25px 25px;
outline-style: solid;
outline-color: white;
outline-width: 10px;
text-align: center;
border: 1px solid silver;
}
<div class="articleQuote">
"80% of North Carolinians polled were in favor of legalizing medical marijuana in the state."
</div>
Another option is to use box-shadow instead of border or outline. This allows you to have as many "borders" as you like.
body {
background: #e6e6e6;
padding: 15px;
}
.articleQuote {
background-color: #FFFFFF;
font-family: 'PT Sans', sans-serif;
font-size: 20px;
color: navy;
padding: 25px 25px 25px 25px;
text-align: center;
margin: 30px 0;
box-shadow: 0 0 0 1px silver,
0 0 0 10px white;
}
.crazy-border {
margin: 50px 10px;
box-shadow: 0 0 0 2px red,
0 0 0 4px white,
0 0 0 6px orange,
0 0 0 8px white,
0 0 0 10px gold,
0 0 0 12px white,
0 0 0 14px green,
0 0 0 16px white,
0 0 0 18px blue,
0 0 0 20px white,
0 0 0 22px purple;
}
<div class="articleQuote">
"80% of North Carolinians polled were in favor of legalizing medical marijuana in the state."
</div>
<div class="articleQuote crazy-border">
"80% of North Carolinians polled were in favor of legalizing medical marijuana in the state."
</div>

Try nested divs.
HTML:
<div class="article-quote-outer">
<div class="article-quote-inner">
{text goes here}
</div>
</div>
CSS:
.article-quote-outer {
padding: 12px;
background-color: white;
}
.article-quote-inner {
border: 1px solid silver;
padding: 15px;
}
Example:
JSFIDDLE

If the desired result is no white space surrounding the silver border, delete the line:
outline-offset: -10px;

Related

Css content inside shape

Hi am trying to do the below design how can i add the below shape and add a content to it?
I have looked for a solution in the internet but cant find one.
Please see my code below
.q{
background: #f5f5f5;
padding: 20px;
border-radius: 30px;
moz-border-radius: 30px;
webkit-border-radius: 30px;
margin-bottom: 5px;
cursor: pointer;
}
.q:hover{
font-size: 25px;
box-shadow: 10px 5px 24px -6px rgb(84 172 235 / 72%);
-webkit-box-shadow: 10px 5px 24px -6px rgb(84 172 235 / 72%);
-moz-box-shadow: 10px 5px 24px -6px rgba(84,172,235,0.72);
background: #3c98cb;
color: #ffffff;
}
.blue{
}
.contentp {
display: none;
}
.q:hover .contentp {
display: block;
}
<div class="q">
<div class="blue">
Is it simple and easy to use?
</div>
<div class="contentp">
Webex is designed with a clean User Interface and emphasis on simplicity, based on how users collaborate today. It is optimised for high-quality video and audio, for a smooth, fast experience.
</div>
</div>

webkit-text-stroke cutting the stroke [duplicate]

This question already has an answer here:
Outline effect to text in Arabic using CSS
(1 answer)
Closed 9 months ago.
webkit-text-stroke is not working suitable, I would like to have the text stroke affect like that:
but it appears like that without cutting:
as you can seen when I write long Arabic Text like thet (ملاعــــــب) or (أهــــــــلاً) it is cutting the stroke like that:
this is my code with cutting:
.myText {
font-family: 'DIN Next LT Arabic';
font-style: normal;
font-weight: 500;
font-size: 48px;
line-height: 71px;
/* identical to box height */
display: flex;
align-items: center;
text-align: right;
letter-spacing: -0.02em;
color: #FFFFFF;
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: #2A34BF;
text-shadow: 2px 1.3px 0px #E34D32, 2px 2px 0px #D6F46B;
}
I also need a multi-layes shadow to be like that in the final result:
Finally, I have resolved it and reach the final result using web the text-shadow to make all the texts joined and with about 1px stroke method provided by #kameron
and to create the multi-layered shadow I have used filter and add the numbers of drop shadow I needed
this is the final result same as the final result I needed in the post:
.bg{
background:#2A34C0;
padding:20px;
}
.myText {
font-family: 'DIN Next LT Arabic';
font-style: normal;
font-weight: 500;
font-size: 90px;
line-height: 71px;
display: flex;
align-items: center;
text-align: right;
letter-spacing: -0.02em;
color: #FFFFFF;
text-shadow:
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0;
filter:
drop-shadow(-1px -1px 0px #2A34C0)
drop-shadow(1px 1px 0px #2A34C0)
drop-shadow(3px 2px 0px #D6F46B)
drop-shadow(3px -1px 0px #E34D32);
}
<div class="bg">
<p class="myText">
أهــــــــلاً ملاعــــــب
</p>
</div>

Font outline using only CSS

I'm working on adding a black font outline to white text using CSS. The goal is the image below. So far I've been able to come up with below. Is there any other best practice to closer match the thin outline shown in the image below? Thanks!
.introText {
font-family: 'Nunito', sans-serif;
-moz-text-fill-color: white;
-webkit-text-fill-color: white;
-moz-text-stroke-color: black;
-webkit-text-stroke-color: black;
-moz-text-stroke-width: 2px;
-webkit-text-stroke-width: 2px;
font-size: 50px;
margin-top: 20vh;
}
}
<h1 class='introText text-center'>We've got your perfect spot.</h1>
One way to do that is to use text-shadow and overlap multiple shadows:
.introText {
text-shadow: 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black;
}
4 times in this case.
Example:
.introText {
font-family: "Nunito", sans-serif;
text-shadow: 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black;
color: white;
font-size: 50px;
margin-top: 20vh;
}
<h1 class="introText text-center">We've got your perfect spot.</h1>
It creates a very similar effect and you can make it stronger or weaker depending on how many repetitions you use.
Maybe this is what your asking
.introText {
font-family: 'Nunito', sans-serif;
background: gray;
color: white;
font-size: 50px;
font-weight: 400;
border: 100px white solid;
margin-top: 20vh;
}
<h1 class='introText text-center'>We've got your perfect spot.</h1>

Extra Padding on my site using ProfitBuilder WP

I am currently copying this site: http://www.onlinemeetingnow.com/register/?id=q6wpivs95c& here: http://beaminggeek.com/profitbuilder/test-2/
and using a WP tool called ProfitBuilder: http://wpprofitbuilder.com/
I have three issues here in particular.
1. I put margin-top: 20px; on my tag (to push it on the center) on the image below however when I do it adds up a margin on the both top and below:
Here's my code on that:
<h2 style="text-align: center; font-size: 40px; font-weight: bold;"><span style="color: #ffffff; ">The 4-Step Strategy We Used to Build a</span><br /> <span style="color: #ffffff;"> 7-Figure Coaching Business...</span><br /> <span style="color: #ffffff; font-size: 25px; "> (while ignoring ALL the conventional wisdom!)</span></h2><p style="text-align: center;"><a style="font-family: 'Open Sans Condensed'; text-shadow: 1px 1px 1px rgba(0,0,0,0.3); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd800',endColorstr='#f7d100'); background: -moz-linear-gradient(center top,#ffd800 5%,#f7d100 100%); background-color: #ffd800; display: block; margin: 0 auto; position: relative; min-height: 33px; width: 280px; text-decoration: none; font-weight: bold; font-size: 30px; color: #fdffff; cursor: pointer; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border: none; padding: 17px 10px; text-align: center; z-index: 2; margin-top: 12px;" href="#">Claim My Spot Now >></a></p>
I also have some issues with this two section here as there are spaces all around:
Any idea what to move to make it look perfect using inline-CSS? YOu can use Chrome inspector tool to check this.
NOTE: The Profit Builder Tool is a tool that doesnt go with custom css panel with it meaning everything is just plain inline CSS.
You have a padding-bottom set for your Claim Your Spot Now button. So when you put a margin-top value on top of your h2 it pushes your p down as well and the padding-bottom of the p pushes down the following section
I think this should work
body {
margin: -1px 0 0 0
}
h2 {
margin: 25px 0 0 0;
}
.pbuilder_column {
margin: 0 0 -24px 0
}

glowing text dark background

I'm trying to figure out how to make glowing text with css on a dark background. Here's what I've got:
.blackbox, .whitebox {
padding: 20px;
display: table;
border: 1px solid black;
}
.whitebox {
background-color: white;
color: black;
text-shadow: 0 0 5px #000;
}
.blackbox {
background-color: black;
color: white;
text-shadow: 0 0 5px #fff;
}
<div class="whitebox">
Hi there.
</div>
<div class="blackbox">
Hi there.
</div>
The black text in the white box is showing the glow that I defined as black, but the white text in the black box shows nothing. What I'm I doing wrong?
Text shadow property parameters are as follows
text-shadow: h-shadow v-shadow blur-radius color|none|initial|inherit;
h-shadow and v-shadow are horizontal and vertical distances. You need to adjust that as well to get the proper shadow. Look at the snippet below.
<html>
<head>
<style>
.blackbox,
.whitebox {
padding: 20px;
display: table;
border: 1px solid black;
}
.whitebox {
background-color: white;
color: black;
text-shadow: 0 0 5px #000;
}
.blackbox {
background-color: black;
color: white;
text-shadow: 8px 8px 5px #fff
}
</style>
</head>
<body>
<div class="whitebox">
Hi there.
</div>
<div class="blackbox">
Hi there.
</div>
</body>
</html>
The white and black shadows are showing in same intensity. But our eyes are more sensitive to the black shadow rather than white shadow. Try changing the h-shadow and v-shadow properties
Add something to encapsulate the text inside
.blackbox,
.whitebox {
padding: 20px;
display: table;
border: 1px solid black;
}
.whitebox {
background-color: white;
color: black;
text-shadow: 0 0 5px #000;
}
.blackbox {
background-color: black;
}
.blackbox p {
color: white;
text-shadow: 0 0 5px #fff;
}
<div class="whitebox">
Hi there.
</div>
<div class="blackbox">
<p>Hi there.</p>
</div>
You can do this by adding multiple text shadows as shown in the snippet below.
To bring a cool effect use different neon colors in the subsequent shadow colors.
.blackbox, .whitebox {
padding: 20px;
display: table;
border: 1px solid black;
}
.whitebox {
background-color: white;
color: black;
text-shadow: 0 0 5px #000;
}
.blackbox {
background-color: black;
color: white;
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff;
}
<div class="whitebox">
Hi there.
</div>
<div class="blackbox">
<p>Hi there.</p>
</div>
Hope this helps.
Cheers.