Hi i'm trying to make a responsive speech bubble with an image on top from the examples of Nicolas Gallagher http://nicolasgallagher.com/pure-css-speech-bubbles/demo/.
But getting problems with the responsive part because i have changed the pinched part in the speechbubble to be in the bottom-left part of the bubble/text box.
.pinched > :first-child:before {
content: "";
position: absolute;
bottom: -20px;
right: 0;
width: 70%;
height: 20px;
background:#fff;
/* css3 */
-webkit-border-top-left-radius:15px;
-moz-border-radius-topleft:15px;
border-top-left-radius:15px;
}
I have made an example here:
https://jsfiddle.net/g5k07rL9/
But the example isn't responsive and the pinch not sharp/pointy in the edge.
How do i get the pinch in the left side without getting these bugs?
speechbubble re-sizing window
speechbubble mobile window
Here is the curvy pinched tip css bubble.
* {font-family: arial;}
.bubble {
padding: 1.5em;
background: #CCC;
border: 2px solid #999;
border-radius: 1em;
width: 60%
}
.bubble:after {
top: 42px;
left: 10px;
position: relative;
font-size: 50px;
line-height: 0;
color: #ccc;
}
.circle {
border-radius: 50%;
background: #ccc;
width: 70px;
height: 70px;
position: relative;
left: 15px;
border: 2px solid #999;
}
.pinch {
background: #999;
height: 15px;
width: 100px;
}
.pinch span {
background: #FFF;
display: inline-block;
width: 50px;
height: 15px;
}
.lft {border-top-right-radius: 15px}
.rgt {border-top-left-radius: 15px;}
<div class="bubble">
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
</div>
<div class="pinch"><span class="lft"></span><span class="rgt"></span> </div>
<div class="circle">
</div>
Preview at : https://jsfiddle.net/itsselvam/fuxm42sj/
Related
I'm trying to place an image in a circle div that's placed above a section containing text like in the image shown:
How can this be done using CSS? Thank you.
Run the Code Here
https://www.w3schools.com/code/tryit.asp?filename=GHOLRSYI9PEK
.flex-wrapper{
background-color: lightgray;
padding: 30px;
padding: 30px 30px 30px 100px;
}
.flex-container {
display: flex;
background-color: #f1f1f1;
}
.flex-container > div {
margin: 10px;
padding: 10px;
font-size: 16px;
}
.flex-container{
-webkit-box-shadow: 0 0 10px 1px rgba(0,0,0,0.2);
-moz-box-shadow: 0 0 10px 1px rgba(0,0,0,0.2);
box-shadow: 0 0 10px 1px rgba(0,0,0,0.2);
}
.avatar-wrapper{
min-width: 150px;
position: relative;
margin-left: -50px !important;
margin: 10px;
padding: 10px;
font-size: 16px;
height: 150px;
display: flex;
align-items: center;
justify-content: center;
}
.avatar-wrapper:after{
content: '';
height: calc(100% + 40px);
width: calc(100% + 40px);
position: absolute;
background: purple;
top: -20px;
left: -20px;
border-radius: 50%;
z-index: 0;
}
.avatar-wrapper > img{
width: 150px;
height: 150px;
z-index: 1;
position: relative;
border-radius: 50%;
}
<div class="flex-wrapper">
<div class="flex-container">
<div class="col avatar-wrapper">
<img src="https://via.placeholder.com/200" alt="sample">
</div>
<div class="col text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</div>
</div>
</div>
img{ border-radius:50%; z-index:1 }
.container{
z-index:0;
margin-left:-100px;
box-shadow: 0px 0px 10px 1px lightgrey;
padding:5px;
width:50%;
}
.text{
text-decoration:underline blue;
margin-left:100px;
}
<div style="display:flex;">
<img src="https://via.placeholder.com/250">
<div class="container">
<div class="text">
I'm trying to place an image in a circle div that's placed above a section containing text like in the image shown:
</div>
</div>
</div>
Here is your solution. Just add your Image url in img tag
When I add two section in my page the sidebar vertically equals the
second section, I need my first section and aside to be vertically equal.
How do I accomplish this? I tried float: left on Section 1 and display: inline on the parent section, but those seemed to cause aside to "break out".
when I add two section in my page the sidebar vertically equals the
second section, I need my first section and aside to be vertically equal.
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
* {
margin: 0;
padding: 0;
}
a {
color: #444;
}
body,
html {
width: 100%;
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0
}
body {
background: #f7f7f7;
min-height: 100%;
height: auto;
position: relative;
font-family: 'Roboto', sans-serif;
line-height: normal;
font-weight: normal;
font-size: 1em;
}
.site-header {
position: relative;
z-index: 99;
float: left;
width: 100%;
margin-bottom: 20px;
padding: 0;
background: #FFF;
}
#page,
.container {
width: 1124px;
min-width: 240px;
position: relative;
margin-right: auto;
margin-left: auto;
}
.header-inner {
width: 100%;
height: 100%;
display: table;
padding: 1% 0;
}
.secondary-navigation {
background: #17aa1c;
}
a:link,
a:visited,
a:active {
text-decoration: none;
}
a:active,
a:hover {
outline: 0;
}
.main-navigation ul li {
display: inline-block;
padding-top: 19px;
padding-bottom: 19px;
padding-left: 20px;
padding-right: 20px;
text-decoration: none;
}
.main-navigation ul li a {
color: #fff;
}
.main-navigation ul li a:hover {
color: #ff9;
}
.secondary-navigation {
width: 100%!important;
}
.content-area {
width: 55%;
float: left;
margin-left: 100px;
margin-right: 1%;
margin-bottom: 20px;
background: #FFF;
padding: 0 10px;
-webkit-box-shadow: 0 1px 1px #c2c4c4;
-moz-box-shadow: 0 1px 1px #c2c4c4;
box-shadow: 0 1px 1px #c2c4c4;
text-shadow: 0 1px 1px #FFF;
clear: both;
}
.aside {
float: left;
width: 20%;
margin-bottom: 20px;
background: #FFF;
padding: 0 10px;
text-shadow: 0 1px 1px #FFF;
}
.inner {
padding: 10px;
}
.title {
font-weight: 500;
color: #444;
text-transform: uppercase;
margin: 0;
}
.post-info {
display: inline-table;
color: #919191;
float: left;
clear: both;
width: 100%;
}
.post-info>span {
display: inline-block;
font-size: 0.9em;
padding: 10px;
color: #919191;
text-transform: uppercase;
}
<section class="content-area">
<article>
<div class="inner">
<h2 class="title">sasasasanostrud exercitation ullamco laboris nisi ut aliquip</h2>
<div class="post-info">
<span>Posted</span>
<span>Category</span>
<span>Date</span>
</div>
<p>ipsum dolor sit amet, consectetur adipisicing elit, sed do quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
</p>
<div class="readmore">Readmore</div>
</div>
</article>
</section>
<section id="primary" class="content-area">
<div class="inner">
<h2 class="title">sasasasanostrud exercitation ullamco laboris nisi ut aliquip</h2>
<div class="post-info">
<span>Posted</span>
<span>Category</span>
<span>Date</span>
</div>
<p>ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
</p>
<div class="readmore">Readmore</div>
</div>
</section>
<aside class="aside ">
<div class="inner">
<h3>Popular Posts</h3>
<ul>
<li>tempor incididunt ut labore et doloreincididunt ut labore et</li>
<li>tempor incididunt ut labore et dolore</li>
<li>tempor incididuntincididunt ut labore et ut labore et dolore</li>
</ul>
</div>
</aside>
Just wrap elements into flex-container and remove float: left. Demo:
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
* {
margin: 0;
padding: 0;
}
a {
color: #444;
}
body,
html {
width: 100%;
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0
}
body {
background: #f7f7f7;
min-height: 100%;
height: auto;
position: relative;
font-family: 'Roboto', sans-serif;
line-height: normal;
font-weight: normal;
font-size: 1em;
}
.site-header {
position: relative;
z-index: 99;
float: left;
width: 100%;
margin-bottom: 20px;
padding: 0;
background: #FFF;
}
#page,
.container {
width: 1124px;
min-width: 240px;
position: relative;
margin-right: auto;
margin-left: auto;
}
.header-inner {
width: 100%;
height: 100%;
display: table;
padding: 1% 0;
}
.secondary-navigation {
background: #17aa1c;
}
a:link,
a:visited,
a:active {
text-decoration: none;
}
a:active,
a:hover {
outline: 0;
}
.main-navigation ul li {
display: inline-block;
padding-top: 19px;
padding-bottom: 19px;
padding-left: 20px;
padding-right: 20px;
text-decoration: none;
}
.main-navigation ul li a {
color: #fff;
}
.main-navigation ul li a:hover {
color: #ff9;
}
.secondary-navigation {
width: 100%!important;
}
.content-area {
width: 55%;
margin-left: 100px;
margin-right: 1%;
margin-bottom: 20px;
background: #FFF;
padding: 0 10px;
-webkit-box-shadow: 0 1px 1px #c2c4c4;
-moz-box-shadow: 0 1px 1px #c2c4c4;
box-shadow: 0 1px 1px #c2c4c4;
text-shadow: 0 1px 1px #FFF;
clear: both;
}
.aside {
width: 20%;
margin-bottom: 20px;
background: #FFF;
padding: 0 10px;
text-shadow: 0 1px 1px #FFF;
}
.inner {
padding: 10px;
}
.title {
font-weight: 500;
color: #444;
text-transform: uppercase;
margin: 0;
}
.post-info {
display: inline-table;
color: #919191;
float: left;
clear: both;
width: 100%;
}
.post-info>span {
display: inline-block;
font-size: 0.9em;
padding: 10px;
color: #919191;
text-transform: uppercase;
}
.flex {
display: flex;
}
<div class="flex">
<section class="content-area">
<article>
<div class="inner">
<h2 class="title">sasasasanostrud exercitation ullamco laboris nisi ut aliquip</h2>
<div class="post-info">
<span>Posted</span>
<span>Category</span>
<span>Date</span>
</div>
<p>ipsum dolor sit amet, consectetur adipisicing elit, sed do quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
</p>
<div class="readmore">Readmore</div>
</div>
</article>
</section>
<aside class="aside ">
<div class="inner">
<h3>Popular Posts</h3>
<ul>
<li>tempor incididunt ut labore et doloreincididunt ut labore et</li>
<li>tempor incididunt ut labore et dolore</li>
<li>tempor incididuntincididunt ut labore et ut labore et dolore</li>
</ul>
</div>
</aside>
</div>
<section id="primary" class="content-area">
<div class="inner">
<h2 class="title">sasasasanostrud exercitation ullamco laboris nisi ut aliquip</h2>
<div class="post-info">
<span>Posted</span>
<span>Category</span>
<span>Date</span>
</div>
<p>ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
</p>
<div class="readmore">Readmore</div>
</div>
</section>
FYI I’m noob with code, so as much help you can give is greatly appreciated. So I have some nice css to give me equidistant images, but when I try to add text below each image, it doesn’t display. In Brackets I can see a super thin line below the image, but no text. Tried tweaking css for the text and image div but no luck.
Fiddle is here: https://jsfiddle.net/datCodeTho/feosv4Lv/
Here's the html:
<div id="container">
<div><img src="http://www.craighuff.ca/img/STIRR_LOW-FI_RECORD_comp.jpg" id="wire1" alt="Stirr wireframe low-fi record screen">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit </p>
</div>
<div><img src="http://www.craighuff.ca/img/STIRR_LOW-FI_RECORD_comp.jpg" id="wire2" alt="Stirr wireframe low-fi record screen"></div>
<div><img src="http://www.craighuff.ca/img/STIRR_LOW-FI_RECORD_comp.jpg" id="wire3" alt="Stirr wireframe low-fi record screen"></div>
</div>
<div id="belowImages"></div>
And here's the css:
#container {
text-align: justify;
border: 10px solid black;
font-size: 0.1px; /* IE 9/10 don't like font-size: 0; */
}
#container div {
width: 30%;
display: inline-block;
background: red;
}
#container:after {
content: '';
width: 100%; /* Ensures there are at least 2 lines of text, so justification works */
display: inline-block;
}
#wire1{
display: block;
width: 100%;
}
#wire2{
display: block;
width: 100%;
}
#wire3{
display: block;
width: 100%;
}
#belowImages {
display: block;
height: 300px;
border: 10px solid black;
background: red;
font-size: 0.1px; /* IE 9/10 don't like font-size: 0; */
min-width: 600px;
}
Just define a style your p-tag:
#container p {
padding: 3px 5px;
color: white;
font-size:9px;
}
I'm working on this block of HTML CSS, I need the image to overlap slightly the header div (in blue).
I'm doing this as shown in the jsfiddle here: https://jsfiddle.net/49zcmf4z/3/
the HTML
<div class="container">
<div class="row">
<div class="col-md-12 block-header">
<div class="col-md-offset-6 col-md-6 text-center block-header">
<h1>Title</h1>
</div>
</div>
<div class="row">
<div class="col-md-6 image text-center">
<img src="http://placehold.it/350x150">
</div>
<div class="col-md-6">
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
</div>
</div>
</div>
</div>
</div>
and the CSS
body {
margin: 10px;
}
.container {
border: solid 1px red;
}
.image {
position: relative;
z-index: 10;
}
#media (min-width: 200px) {
.image img {
transform: translateY(-5em);
}
}
.image img {
width: 100%;
border: solid 1px black;
margin-left: 1em;
}
.block-header {
background-color: blue;
height: 85px;
padding-left: 0px;
padding-right: 0px;
}
#media (max-width: 992px) {
.block-header {
padding-top: 1px;
}
}
.block-header h1 {
color: white;
}
my problem is that after translating up the image, the div that contains it remains unchanged, and has lots of white space in the place where the image used to be.
Hey you could try to use margins instead of transform, it's easier :
.image {
position: relative;
z-index: 10;
#media (min-width: 200px) {
img {
margin-top: -5em;
}
}
img {
width: 100%;
border: solid 1px black;
margin-left: 1em;
}
}
https://jsfiddle.net/49zcmf4z/4/
You can always "hardcode" the margins of the image (probably not best solution):
img {
width: 100%;
border: solid 1px black;
margin-left: 1em;
margin-bottom: -4em;}
https://jsfiddle.net/49zcmf4z/5/
I try to add a border on the bottom of an h4 title with some extra css and custom length. I know that the only way, compatible with the most browsers is using the ::before rule. However, I have the following problem on the code:
<div class="my_div_class">
<h4>This is a title</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat</p>
</div>
.my_div_class h4::before {
position: absolute;
margin: auto;
z-index: 1;
content: "";
width: 75%;
height: 2px;
background: black;
left: 12.5%;
bottom: 0;
}
.my_div_class h4 {
margin-bottom: 25px;
}
.my_div_class {
width: 30%;
height: 250px;
}
The border goes to the end of the page (or in my website, to the end of the bigger div element) instead of the end of the h4.
Here is a jsfiddle. You can barely see it in the bottom of the page.
.my_div_class h4::before {
position:absolute;
margin: auto;
z-index: 1;
content: "";
width: 75%;
height: 2px;
background: black;
margin-top:1em;
left: 12.5%;
}
What has changed:
bottom:0; <--- Removed
margin-top:1em; <--- Added
https://jsfiddle.net/550ttypa/3/