Text below image not displaying - html

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;
}

Related

flexbox parent is having trouble with children elements

the parent div, .blog_content, has two childern, one is a p element and the other is an image. for some reason they are behaving like block objects and not inline block. what is happenning is they are appearing on top of each other, like block elements would and not beside each other like what im trying to accomplish. i have set widths for them but they seem to be just ignoring them.
ill post the code below.
the relevant html
edit to show the full code
<!doctype html>
<html>
<head>
<title>My blog</title>
<link rel="stylesheet" href="styles/style.css">
</head>
<body>
<nav>
<div id="nav_links">
Home
all posts
Services
About
Contact
</div>
<div id="nav_search">
<form method="post" action="#">
<input id="nav_form_input" type="text" name="nav_search" placeholder="Search">
<input id="nav_search_submit" type="submit" value="GO">
</form>
</div>
</nav>
<main>
<section>
<article>
<h1>My first blog post</h1>
<hr>
<div class="blog_content">
<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 in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborumLorem 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>
<img src="images/159.jpg" alt="shit hot 159">
</div>
</article>
</section>
<aside>
</aside>
</main>
</body>
</html>
the relevant css
/* -------------------------------------------------------------------------------------------------------------------------------------*/
/* START OF HEADER.HTML STYLES */
/* -------------------------------------------------------------------------------------------------------------------------------------*/
nav {
position: relative;
height: 40px;
width: 100%;
background-color: rgb(40,50,60);
}
#nav_links {
position: relative;
float: left;
padding-left: 40px;
height: 40px;
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
}
#nav_search {
position: relative;
float: right;
padding-right: 80px;
height: 40px;
display: flex;
flex-flow: row nowrap;
justify-content: flex-end;
align-items: center;
}
nav > #nav_links > a {
text-decoration: none;
font-family: arial;
font-size: 12px;
color: rgb(220,220,220);
padding-left: 25px;
text-shadow: 0px 0px 1px grey;
letter-spacing: 1px;
}
#nav_form_input{
border-radius: 10px 0px 0px 10px;
height: 20px;
border: none;
outline: none;
color: rgb(220,220,220);
background-color: rgb(60,70,80);
padding: 5px;
}
#nav_search_submit {
border-radius: 5px;
height: 30px;
border: 1px solid rgb(60,110,30);
background: linear-gradient(rgb(100,160,80), rgb(90,140,60));
font-family: arial;
font-weight: bold;
color: rgb(240,240,240);
}
/* -------------------------------------------------------------------------------------------------------------------------------------*/
/* START OF MAIN.HTML STYLES */
/* -------------------------------------------------------------------------------------------------------------------------------------*/
main {
position: relative;
margin: 0 auto;
display: flex;
flex-flow: nowrap ;
width: 100%;
min-height: 600px;
flex-flow: row nowrap;
justify-content: space-around;
align-items: flex-start;
}
main section {
margin: 20px auto;
width: 65%;
min-height: 400px;
}
main section article {
border-radius: 30px 30px 0px 0px;
background-color: rgb(240,240,240);
height: 400px;
}
main section article h1 {
margin: 0 auto;
padding: 10px 0px 10px 20px;
border-radius: 30px 20px 0px 0px;
border: 2px 2px 0px 2px solid rgb(0,0,255);
color: white;
letter-spacing: 1px;
background: linear-gradient(rgb(80,170,240), rgb(60,140,240));
font-weight: 400;
}
hr {
width: 95%;
color: rgb(120,120,120);
}
.blog_content {
display: inline-flex;
flex-flow: row nowrap;
justify-content: space-between;
width: 100%;
}
main section article p {
overflow: hidden;
text-overflow: ellipsis;
white-space: wrap;
width: 42%;
}
main section article img {
margin: 3%;
width: 42%;
border-radius: 4px;
}
main aside {
margin: 20px auto;
width: 20%;
min-height: 400px;
border: 1px solid black;
}
i have tried using both flex and inline-flex but no joy with either

Align contents vertically in middle of flexed div

I would like to align the contents of div in the middle of vertical alignment. Table-cell will not function here, due to the fact, that parent is and must be displayed flex. This is used in the new WordPress Gutenberg editor. I do not want to modify the editor itself if possible and achieve this with CSS alone. Below you will find how the code looks currently. Custom HTML also cannot be added without editing editor. Is there a possibility of this be achieved in the current state?
Desired result:
Current code and state:
JSFiddle
HTML:
<div class="wp-block-columns has-2-columns right-33">
<div class="wp-block-column">
<h3>Some title</h3>
<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>
<div class="wp-block-column">
<figure class="wp-block-image">Here be image</figure>
</div>
</div>
CSS:
h3 {margin: 0 0 20px 0;}
.wp-block-columns {
display: flex;
flex-wrap: no-wrap;
padding: 5px;
border: solid 1px red;
}
.wp-block-column {
flex: 1;
margin-bottom: 1em;
flex-basis: 100%;
min-width: 0;
word-break: break-word;
overflow-wrap: break-word;
flex-grow: 0;
border: solid 1px blue;
}
.right-33 > div:first-child {
flex-basis: 66.6666%;
margin-right: 32px;
}
.right-33 > div:last-child {
flex-basis: 33.3333%;
margin-left: 32px;
}
.wp-block-image {
background: green;
margin: 0 auto;
width: 100%;
height: 200px;
}
You can add this to your wp-block-column column:
.wp-block-column {
display: flex;
flex-direction: column;
justify-content: center;
}
Here's your updated JSFiddle.
This is a great visual guide on Flexbox, it might help you in the future.
Create a column flexbox to .right-33>div:first-child and align to center using justify-content: center - see demo below:
h3 {
margin: 0 0 20px 0;
}
.wp-block-columns {
display: flex;
flex-wrap: no-wrap;
padding: 5px;
border: solid 1px red;
}
.wp-block-column {
flex: 1;
margin-bottom: 1em;
flex-basis: 100%;
min-width: 0;
word-break: break-word;
overflow-wrap: break-word;
flex-grow: 0;
border: solid 1px blue;
}
.right-33>div:first-child {
flex-basis: 66.6666%;
margin-right: 32px;
/*ADDED FLEXBOX*/
display: flex;
flex-direction: column;
justify-content: center;
}
.right-33>div:last-child {
flex-basis: 33.3333%;
margin-left: 32px;
}
.wp-block-image {
background: green;
margin: 0 auto;
width: 100%;
height: 200px;
}
<div class="wp-block-columns has-2-columns right-33">
<div class="wp-block-column">
<h3>Some title</h3>
<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>
<div class="wp-block-column">
<figure class="wp-block-image">Here be image</figure>
</div>
</div>
The setting to use for vertically centered alignment of flex children is align-items: center;, applied to the flex container. I added it to your code here (at the end of the CSS section):
h3 {
margin: 0 0 20px 0;
}
.wp-block-columns {
display: flex;
flex-wrap: no-wrap;
padding: 5px;
border: solid 1px red;
}
.wp-block-column {
flex: 1;
margin-bottom: 1em;
flex-basis: 100%;
min-width: 0;
word-break: break-word;
overflow-wrap: break-word;
flex-grow: 0;
border: solid 1px blue;
}
.right-33>div:first-child {
flex-basis: 66.6666%;
margin-right: 32px;
}
.right-33>div:last-child {
flex-basis: 33.3333%;
margin-left: 32px;
}
.wp-block-image {
background: green;
margin: 0 auto;
width: 100%;
height: 200px;
}
.wp-block-columns.has-2-columns.right-33 {
align-items: center;
}
<div class="wp-block-columns has-2-columns right-33">
<div class="wp-block-column">
<h3>Some title</h3>
<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>
<div class="wp-block-column">
<figure class="wp-block-image">Here be image</figure>
</div>
</div>

CSS3 Speechbubble with image

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/

::before rule doesn't follow the size of the element

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/

Aligning elements inside display:cell

I have the following code:
Also found here as a jsfiddle.
.font_color_white {
color: white;
}
.font_20px {
font-size: 20px;
}
.font_weight_bold {
font-weight: bold;
}
.bg_color_orange {
background-color: rgb(255, 97, 56);
}
.section_container {
display: block;
position: relative;
width: 100%;
height: auto;
min-width: 960px;
margin-top: 20px;
}
.section_container_inner {
margin: 0 auto;
display: block;
position: relative;
}
.section_block {
display: block;
float: left;
position: relative;
height: auto;
}
.section_block_header {
display: block;
position: relative;
text-align: center;
margin-bottom: 5px;
}
.section_block_table {
display: table;
position: relative;
}
.section_block_row {
display: table-row;
position: relative;
}
.section_block_cell {
display: table-cell;
position: relative;
}
.width_960px {
width: 960px;
}
.height_50px {
height: 50px;
line-height: 50px;
vertical-align: middle;
}
.margin_top_10px {
margin-top: 10px;
}
.padding_left_5px {
padding-left: 5px;
}
.padding_top_minus_5px {
padding-top: -5px;
}
.display_block {
display: block;
}
.box_orange {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 2px solid rgb(255, 97, 56);
width: 20px;
height: 20px;
}
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<div class="section_block_table width_960px">
<div class="section_block_header height_50px width_960px bg_color_orange">
<span class="font_color_white font_20px">FAQ</span>
</div>
<div class="section_block_row">
<div class="display_block width_960px margin_top_10px">
<div class="section_block_cell">
<div class="box_orange"></div>
</div>
<div class="section_block_cell">
<div class="display_block padding_left_5px font_weight_bold padding_top_minus_5px">
<span class="font_family_cont_m">What's the best way to get started with archery at Kelly's?</span>
</div>
<div class="display_block padding_left_5px ">
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. Excepteur sint occaecat cupidatat.
</div>
</div>
</div>
</div>
</div>
I am trying to get the question to align exactly with the square on the left. So the question text and the square seem as if they are on the same line. Have tried to apply paddings and margins to the question text block, but no luck at all.
Can someone identify what I have been doing wrong?
You need to set the vertical alignment of your table-cell display element.
If you want the square directly in the middle, you can set it to middle:
.section_block_cell {
...
display: table-cell;
vertical-align: middle;
}
JSFiddle demo.
Alternatively you want it at the top, you can set it to top:
.section_block_cell {
...
display: table-cell;
vertical-align: top;
}
Alternative JSFiddle demo.
Not sure about what you try to achieve... If you want your box to be vertical align with the question, see the answers above.
If you want the bow to be vertical align with the first line, i would use absolute positioning for the orange box, with a left padding on the question container :
<div class="display_block width_960px margin_top_10px question">
<div class="box_orange"></div>
<p class="font_family_cont_m font_weight_bold">What's the best way to get started with archery at Kelly's?</p>
<p>
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. Excepteur sint occaecat cupidatat.
</p>
</div>
And the CSS :
.question {
position: relative;
padding-left: 34px;
}
.question p{
margin: 0;
}
.box_orange {
position: absolute;
top: -4px;
left: 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 2px solid rgb(255,97,56);
width: 20px;
height: 20px;
}
Updated Fiddle
Adding the below CSS fixes it:
.section_block_cell:first-of-type {
float: left;
}
Updated JSFiddle.
This works even with non display: table-cell elements...