Trouble forcing text to wrap - html

I am attempting to put several messages in a thread-like layout. To see the result of what I have, go here: http://jsfiddle.net/sunjay03/Aykqc/embedded/result/
If you adjust the width of the screen, you will see that the text in the lower message does not layout properly. As well as that, I can't seem to get the date to always go to the very right of the screen.
Here is the link to the full jsfiddle: http://jsfiddle.net/sunjay03/Aykqc/
Here are some images of what I'd like to happen:
Any help?

I fiddled around with your fiddle and made this of it:
http://jsfiddle.net/S7drj/1/
HTML:
<div class="messages">
<div class="message">
<div class="message-image">
<img src="http://www.sunjay.ca/images/logo_notext.gif" alt="profile_image">
</div>
<div class="message-body">
<div class="message-name">
<span class="message-date">Nov. 15, 2010</span>
<h3>John Smith</h3>
</div>
<div class="message-text">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
</div>
<div class="message">
<div class="message-image">
<img src="http://www.sunjay.ca/images/logo_notext.gif" alt="profile_image">
</div>
<div class="message-body">
<div class="message-name">
<span class="message-date">Nov. 15, 2010</span>
<h3>Joe Smith</h3>
</div>
<div class="message-text">
<p>Aliquam commodo dui at mauris tempus eu commodo nunc commodo. Quisque accumsan semper sapien, quis tristique odio egestas ac.</p>
</div>
</div>
</div>
</div>
CSS:
body
{
margin: 20px;
}
.message
{
padding: 2px;
margin: 2px;
clear: both;
width:100%;
}
.message .message-image
{
padding: 5px;
float:left;
}
.message .message-body
{
}
.message .message-body .message-name
{
}
.message .message-body .message-name h3
{
}
.message .message-body .message-text
{
}
.message .message-body .message-date
{
float: right;
}
Is that how you want it?

How's this jsFiddle?
HTML:
<div class="container">
<div class="name">John Smith</div>
<div class="date">Nov. 15, 2010</div>
<div class="content">Aliquam commodo dui at mauris tempus eu commodo nunc commodo. Quisque accumsan semper sapien, quis tristique odio egestas ac.</div>
</div>
<div class="container">
<div class="name">John Smith</div>
<div class="date">Nov. 15, 2010</div>
<div class="content">Aliquam commodo dui at mauris tempus eu commodo nunc commodo. Quisque accumsan semper sapien, quis tristique odio egestas ac.</div>
</div>
<div class="container">
<div class="name">John Smith</div>
<div class="date">Nov. 15, 2010</div>
<div class="content">Aliquam commodo dui at mauris tempus eu commodo nunc commodo. Quisque accumsan semper sapien, quis tristique odio egestas ac.</div>
</div>
CSS:
.name {
float:left;
}
.date {
float:right;
}
.content {
clear:both;
}
.container {
overflow:auto;
padding-left:115px;
background: url(http://www.sunjay.ca/images/logo_notext.gif) no-repeat;
min-height: 110px;
margin-bottom: 20px;
}

Related

Header overlay over Hero

I am working on a website. I am a little rusty when it comes to CSS. I am trying to get the same effect as this page https://prp.fm/. I want the header to be over the hero section with a transparent background. The header does not need to be sticky, but I am unable to get the header to overlay over the header.
I tried adding background-attachment:fixed in the .hero-section CSS, but it would just fix the image to the page and not scroll with the page. That I do NOT want. I want the hero section to be behind the header and scroll with the page.
.main {
padding-top: 0 !important;
}
.header-section {
background: #212121;
padding: 0 33px;
padding-bottom: 50px;
border-bottom: 1px solid #fff;
position: relative:
}
.hero-section {
height: 962px;
background-image: url(../img/chart-bg.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: top center;
padding-top: 0px;
z-index: 100;
}
<header class="header-section" id="header">
<div class="header-warp">
<!-- Site Logo -->
<a href="home.html" class="site-logo">
<img src="img/logo.png" alt="">
</a>
<!-- responsive -->
<div class="nav-switch">
<i class="fa fa-bars"></i>
</div>
</div>
</header>
<div class="main">
<section class="hero-section">
</section>
<div id="inner">
<section class="some-section">
<div class="container">
<div class="section-title text-center">
<h2>Tile</h2>
</div>
<div class="row about-box">
<div class="col-lg-6">
<img src="img/pic1.jpg" alt="">
</div>
<div class="col-lg-6">
<div class="ab-content">
<h4>A short History</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu tincidunt ligula. Fusce dictum ullamcorper purus, at elementum sem sollicitudin non. Sed id tristique lacus. Fusce pellentesque dignissim arcu, id hendrerit urna feugiat vitae.
Pellentesque viverra aliquet arcu, vel aliquet est commodo quis. Nam tempus, nisl eu maximus viverra, magna quam porta nibh.</p>
</div>
</div>
</div>
</div>
</section>
</div>
Just reduce an opacity on the header and increase the font-weight of the contents which are in the header like the following
.main {
padding-top: 0 !important;
}
.header-section {
background: #212121;
padding: 0 33px;
padding-bottom: 50px;
border-bottom: 1px solid #fff;
opacity: .3; /* added */
position: relative:
}
.hero-section {
height: 962px;
background-image: url(../img/chart-bg.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: top center;
padding-top: 0px;
z-index: 100;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<header class="header-section" id="header">
<div class="header-warp">
<!-- Site Logo -->
<a href="home.html" class="site-logo">
<img src="img/logo.png" alt="">
</a>
<!-- responsive -->
<div class="nav-switch">
<i class="fa fa-bars"></i>
</div>
</div>
</header>
<div class="main">
<section class="hero-section">
</section>
<div id="inner">
<section class="some-section">
<div class="container">
<div class="section-title text-center">
<h2>Tile</h2>
</div>
<div class="row about-box">
<div class="col-lg-6">
<img src="img/pic1.jpg" alt="">
</div>
<div class="col-lg-6">
<div class="ab-content">
<h4>A short History</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu tincidunt ligula. Fusce dictum ullamcorper purus, at elementum sem sollicitudin non. Sed id tristique lacus. Fusce pellentesque dignissim arcu, id hendrerit urna feugiat vitae.
Pellentesque viverra aliquet arcu, vel aliquet est commodo quis. Nam tempus, nisl eu maximus viverra, magna quam porta nibh.</p>
</div>
</div>
</div>
</div>
</section>
</div>

How can I remove the space between two divs that are stacked vertically? [duplicate]

This question already has answers here:
Removing space between h1 and h2
(4 answers)
CSS margin-top of <h1> affects parent's margin
(5 answers)
setting the top margin of the h1 element in the header does not work as expected
(6 answers)
Closed 4 years ago.
This question is pretty simple. Take a look at the photo. I what the space between the footer and the div that is above it to be gone. The div and the footer must be flush. I tried every solution I can and I think I need help from someone more expierienced.
Below is the html and css code for what I am trying to do. See link for illustration
HTML and CSS
.content{
margin:0;
width: 100%;
/*padding-top:30px;*/
/*padding-left: 3px;*/
/*padding-right: 0px;*/
/*padding-bottom: 60px;*/
font-family: 'Lato', sans-serif;
}
#footer{
height:200px;
/*width:100%;*/
background:#1c1c1c;
text-align: center;
padding-top:69px;
padding-bottom: 69px;
}
.post_date{
padding:20px 0;
border-top: 1px solid #dbdbdb;
border-bottom: 1px solid #dbdbdb;
width:100%;
color:#dbdbdb;
}
.card{
width:100%;
height:379.6px;
/*background: red;*/
/*padding-left: 2px;*/
}
/*Card 6 properties*/
#c6{
background: #9b59b6;
}
#c6 h3{
color:white;
}
.b6,.s6{
color:white;
}
/**********/
img{
width:100%;
margin: 0px;
}
<section id="section-6" class="grid">
<div class="images img6">
<img src="images/pic12.jpg">
</div>
<div class="card" id="c6">
<div class="content">
<header>
<h3>Magna porta aliguam</h3>
</header>
<p class="post_date"> 3 days ago by <span class="s6">John Doe</span></p>
<p>
Nullam posuere erat vel placerat rutrum. Praesent ac consectetur dui, et congue quam. Donec aliquam lacinia condimentum. Integer porta massa sapien, commodo sodales diam suscipit vitae. Aliquam quis felis sed urna semper semper. Phasellus eu scelerisque mi. Vivamus aliquam nisl libero, sit amet scelerisque ligula laoreet vel.
</p>
<button class="btn b6"> Read More</button>
</div>
</div>
</section>
<footer id="footer">
<div id="social_media">
<ul>
<li><i class="fab fa-twitter"></i></li>
<li><i class="fab fa-facebook-f"></i></li>
<li><i class="fab fa-instagram"></i></li>
</ul>
</div>
<div class="copyright">
#Untitled Design. Templated: Images: Unsplash
</div>
</footer>
</main>
</body>
</html>
This is cause by the h3 margin in you header. Use the next snippet to remove that space.
header h3 {margin-top: 0px;}
Hope this helps :)
Add overflow:auto to your .content div.
Check this out: https://jsfiddle.net/vuyyxa04/
And check out collapsing margins while you're at it.
How about add margin-top: -23px to class card?
Or you can also add margin-bottom : -23 to img
.card{
width:100%;
height:379.6px;
margin-top: -23px;
}
Or
.images.img6 {
margin-bottom: -23px;
}
I hope this helps ^^
You can see it here https://jsfiddle.net/ajz9gj5n/
I found another way to solve this
https://jsfiddle.net/ajz9gj5n/1/
On the css i put
.images.img6 {
display: grid;
}
And i change the html from
<section id="section-6" class="grid">
<div class="images img6">
<img src="https://i.ytimg.com/vi/SfLV8hD7zX4/maxresdefault.jpg">
</div>
<div class="card" id="c6">
<div class="content">
<header>
<h3>Magna porta aliguam</h3>
</header>
<p class="post_date"> 3 days ago by <span class="s6">John Doe</span></p>
<p>
Nullam posuere erat vel placerat rutrum. Praesent ac consectetur dui, et congue quam. Donec aliquam lacinia condimentum. Integer porta massa sapien, commodo sodales diam suscipit vitae. Aliquam quis felis sed urna semper semper. Phasellus eu scelerisque mi. Vivamus aliquam nisl libero, sit amet scelerisque ligula laoreet vel.
</p>
<button class="btn b6"> Read More</button>
</div>
</div>
</section>
into this
<section id="section-6" class="grid">
<div class="images img6">
<img src="https://i.ytimg.com/vi/SfLV8hD7zX4/maxresdefault.jpg">
<div class="card" id="c6">
<div class="content">
<header>
<h3>Magna porta aliguam</h3>
</header>
<p class="post_date"> 3 days ago by <span class="s6">John Doe</span></p>
<p>
Nullam posuere erat vel placerat rutrum. Praesent ac consectetur dui, et congue quam. Donec aliquam lacinia condimentum. Integer porta massa sapien, commodo sodales diam suscipit vitae. Aliquam quis felis sed urna semper semper. Phasellus eu scelerisque mi. Vivamus aliquam nisl libero, sit amet scelerisque ligula laoreet vel.
</p>
<button class="btn b6"> Read More</button>
</div>
</div>
</div>
</section>
I put div "card" inside div "images img6"

How put 4 images and title and description side by side in a html box

How put 4 images and title and description side by side in a html box? No link, only text. As shown below:
Flex box is the way to go:
https://jsfiddle.net/s1mreoe8/1/
.flex{
display:flex;
}
Here is a guide : https://css-tricks.com/snippets/css/a-guide-to-flexbox/
.first {
float: left;
width: 50%;
}
.img {
float: left;
width:39%;
padding:10px;
}
.text
{
width:39%;
float: left;
padding:10px;
}
.img img {
width: 100%;
}
<div class="row">
<div class="first">
<div class="img">
<img src="http://www.fogosglobo.com.br/img/250x250-circle.png" alt="img">
</div>
<div class="text">
<p><strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Nunc molestie, nibh eu molestie vestibulum, urna neque interdum orci, ut egestas diam massa vel magna. Mauris eget nunc nec sem ultrices varius.</p>
</div>
</div>
<div class="first">
<div class="img">
<img src="http://www.fogosglobo.com.br/img/250x250-circle.png" alt="img">
</div>
<div class="text">
<p><strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Nunc molestie, nibh eu molestie vestibulum, urna neque interdum orci, ut egestas diam massa vel magna. Mauris eget nunc nec sem ultrices varius.</p>
</div>
</div>
</div>

Aligning quotation marks with bottom of row in Bootstrap 3?

I'm trying to create some nice looking blockquotes in Bootstrap by stacking some rows with quotes above and below the quotation, like so just to give you a rough example ( can be seen here (http://www.bootply.com/weEUvuQfw2 ). As seen in the bootply example, the left quotation mark hovers high above the quote, since its character is originally that high when used in a sentence. I imagine it's got to be something simple, but what can I do to get the left quote to hover at the bottom of the top left cell of this grid? setting a negative margin or padding doesn't seem to do it. Any ideas?
<div class="container">
<div class="row right">
<div class=" col-lg-3 ">
<font size="40">“</font>
</div>
<div class="col-lg-6 ">
</div>
<div class="col-lg-3 ">
</div>
</div>
<div class="row center">
<div class=" col-lg-3 ">
</div>
<div class="col-lg-6 ">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sit amet blandit libero. Nullam at tincidunt risus. Nam quis suscipit ligula, ut cursus nunc. Nulla eget eros diam. Aenean bibendum accumsan velit in dapibus. Pellentesque sodales leo nec lacus consequat, nec tempor nibh sollicitudin. Fusce mollis luctus ultrices. Quisque tempus placerat velit, at varius libero pulvinar eu. Curabitur sit amet est velit. Praesent id eleifend nulla, eu iaculis lacus. Integer imperdiet, tellus nec tristique mattis, magna quam luctus tellus, nec semper enim felis eget nisl.
</div><!--
--><div class="col-lg-3 ">
</div>
</div>
<div class="row left">
<div class=" col-lg-3 ">
</div>
<div class="col-lg-6 ">
</div><!--
--><div class="col-lg-3 ">
<font size="72">”
</font></div><font size="72">
</font></div><font size="72">
</font></div><!-- /.container -->
And CSS
.center {
text-align: center;
}
.right {
text-align: right;
}
.left {
text-align: left;
}
Are you looking for something like so?
HTML:
<div class="container">
<div class="row right">
<div class=" col-lg-3 ">
<font size="40">“</font>
</div>
<div class="col-lg-6 ">
</div><!--
--><div class="col-lg-3 ">
</div>
</div>
<div class="row center">
<div class=" col-lg-3 ">
</div>
<div class="col-lg-6 ">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sit amet blandit libero. Nullam at tincidunt risus. Nam quis suscipit ligula, ut cursus nunc. Nulla eget eros diam. Aenean bibendum accumsan velit in dapibus. Pellentesque sodales leo nec lacus consequat, nec tempor nibh sollicitudin. Fusce mollis luctus ultrices. Quisque tempus placerat velit, at varius libero pulvinar eu. Curabitur sit amet est velit. Praesent id eleifend nulla, eu iaculis lacus. Integer imperdiet, tellus nec tristique mattis, magna quam luctus tellus, nec semper enim felis eget nisl.
</div><!--
--><div class="col-lg-3 ">
</div>
</div>
<div class="row left">
<div class=" col-lg-3 ">
</div>
<div class="col-lg-6 ">
</div><!--
--><div class="col-lg-3 ">
<font size="72">”
</font></div><font size="72">
</font></div><font size="72">
</font></div><!-- /.container -->
CSS:
.center {
text-align: center;
}
.right {
text-align: left;
margin-bottom: -20px;
}
.left {
text-align: left;
}
Here is a fiddle: http://jsfiddle.net/4g0gp5pp/
That's a lot of markup to create something really simple.
DEMO: http://jsbin.com/hadapo/1/edit
HTML:
<blockquote class="quotemarks">
<p>Words go here</p>
<footer>Someone</footer>
</blockquote>
CSS
.quotemarks:before,
.quotemarks:after {
text-align: center;
font-size: 60px;
line-height: 1;
}
.quotemarks:before {
content: "\201C";
position: relative;
bottom: -20px;
}
.quotemarks:after {
content: "\201D"
}
.quotemarks {
border: 0;
padding: 0;
text-align: center;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
}
.quotemarks footer {
text-indent: -10px
}

center element with unknown height without having it take up space

This is a tricky problem from what I can see. Basically, I have alert messages that need appear on the page just below the navigation and on top of the content below. This is best shown in a fiddle here http://jsfiddle.net/53b6g/1/ - notice the commented style - this style can't be used b/c I don't know how many alerts will be on the page. So the height of the wrapper element is unknown.
HTML:
<div class="nav">
<ul>
<li>first</li>
<li>second</li>
<li>last</li>
</ul>
</div>
<div class="wrapper">
<div class="table">
<div class="tr">
<div class="td">
Let us center this and have same width as below
</div>
</div>
<div class="tr">
<div class="td">
shorter but same width
</div>
</div>
<div class="tr">
<div class="td">
but wait - there could be 3 or 2 or 1 so can't use height calculations
</div>
</div>
</div>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum in dui rhoncus, porttitor nibh ornare, tristique est. Nullam condimentum quam ac metus varius, at fermentum nibh congue. Fusce vel posuere justo, vel vulputate enim. Cras varius libero et felis venenatis ultricies. Vivamus ante est, tempus et aliquet eget, varius id nisi. In a consectetur lacus, vitae lacinia mauris. Nulla pulvinar tellus id laoreet tempus. Integer feugiat quis odio eget ullamcorper.</p>
</div>
CSS:
/*can't use style*/
.wrapper{
position: relative;
top: -4px;
margin-bottom: -70px;
}
/*end can't use style*/
.table{
display: table;
margin: 0 auto;
}
.tr{
display: table-row
}
.td{
display: table-cell;
background: red;
}
.nav{
background: green;
}
.nav ul {
margin: 0;
}
.nav li{
display: inline-block;
}
.content{
background: blue;
}
Here is a fiddle without the commented code showing the problem at hand http://jsfiddle.net/8Awze/. Is this something that can be solved with CSS alone?
HTML:
<div class="nav">
<ul>
<li>first</li>
<li>second</li>
<li>last</li>
</ul>
</div>
<div class="wrapper">
<div class="table">
<div class="tr">
<div class="td">
Let us center this and have same width as below
</div>
</div>
<div class="tr">
<div class="td">
shorter but same width
</div>
</div>
</div>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum in dui rhoncus, porttitor nibh ornare, tristique est. Nullam condimentum quam ac metus varius, at fermentum nibh congue. Fusce vel posuere justo, vel vulputate enim. Cras varius libero et felis venenatis ultricies. Vivamus ante est, tempus et aliquet eget, varius id nisi. In a consectetur lacus, vitae lacinia mauris. Nulla pulvinar tellus id laoreet tempus. Integer feugiat quis odio eget ullamcorper.</p>
</div>
CSS:
.table{
display: table;
margin: 0 auto;
}
.tr{
display: table-row
}
.td{
display: table-cell;
background: red;
}
.nav{
background: green;
}
.nav ul {
margin: 0;
}
.nav li{
display: inline-block;
}
.content{
background: blue;
}
If I'm understanding you correctly, you should be able to use position: absolute as follows:
.wrapper{
position: absolute;
width: 100%;
top: 25px;
}
http://jsfiddle.net/53b6g/2/