I have an ordered list which is actually a display of products on a page. Within each list item (li) there is some content followed by a div containing some more content, before closing the list item.
I need for the div within each list item to expand (its width) beyond its parent list item and actually fill the width of the ordered list (ol). Each div also needs to sit directly below its parent list item and push any following list items down.
I know the probably doesn't make sense, it's not very easy to explain.
Here's the HTML I have so far:
<ol class="products group">
<li>
<a href="#">
<img src="assets/img/ind-aerospace.jpg" align="" />
<h4>Product Title</h4>
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum porttitor blandit lacus in sodales.</p>
</li>
<li>
<a href="#">
<img src="assets/img/ind-automotive.jpg" align="" />
<h4>Product Title</h4>
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Vestibulum porttitor blandit lacus in sodales.</p>
<!-- Expand this -->
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum porttitor blandit lacus in sodales.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum porttitor blandit lacus in sodales.</p>
</div>
</li>
<li>
<a href="#">
<img src="assets/img/ind-power.jpg" align="" />
<h4>Product Title</h4>
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Vestibulum porttitor blandit lacus in sodales.</p>
</li>
<li>
<a href="#">
<img src="assets/img/ind-power.jpg" align="" />
<h4>Product Title</h4>
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Vestibulum porttitor blandit lacus in sodales.</p>
</li>
<li>
<a href="#">
<img src="assets/img/ind-power.jpg" align="" />
<h4>Product Title</h4>
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Vestibulum porttitor blandit lacus in sodales.</p>
</li>
<li>
<a href="#">
<img src="assets/img/ind-power.jpg" align="" />
<h4>Product Title</h4>
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at auctor justo. Vivamus non elit velit. Vestibulum porttitor blandit lacus in sodales.</p>
</li>
Here's my CSS:
ol.products {
position: relative;
}
ol.products li {
list-style: none;
float: left;
width: 30%;
margin: 0 3% 1.5em 0;
border-bottom: dotted 1px #ed2124;
border-bottom: dotted 1px rgba(237,33,36,.5);
}
ol.products li p {
margin: .5em 0;
min-height: 140px;
line-height: 1.2em;
}
ol.products li div {
position: relative;
width: 100%;
border: solid 1px red;
}
ol.products li div p {
min-height: 0;
}
Here's a wireframe of the list that might help it make a little sense:
You should use jQuery to accomplish this. You can add a "expandable" class to each of the info boxes and in the css have it display:none; then when you click on the parent info button use jQuery to position the box as you need it to (and return the display to visible, add animation, fade, etc). You will need to have jQuery traverse your html and place the info box in the correct area.
I tried something similar with css hover states, you can see my results here:
CSS Popouts
It's similar because I have a nested div that's set to display:none by default and is set to display:block by a hover anywhere on the list item.
The div floats overtop the other content though, rather than pushing it out of the way like your wireframes seem to indicate. You might have to get some JS going for you like #JohnP and #Collin White mentioned.
Related
I'm struggling to achieve responsive column. Currently all columns are not the same height. When the screen gets smaller, the paragraphs are not the same level, I am trying to make them the same level no matter what screen size. My next problem is the button will also not be the same level in all columns.
Bellow is currently my HTML:
<div class="container">
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>test heading text</h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" /> <h2>Fencing and Gates</h2>
<h2>test heading text long</h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. Maecenas id leo at elit vestibulum sagittis at in ex. Cras vulputate laoreet dictum. Vestibulum nec quam placerat, blandit orci in, hendrerit ante. </p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>test heading text longer </h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. </p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>test heading text longer longer </h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. </p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>test heading text</h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. </p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>Block Paved Driveways and Paths</h2>
<h2>test heading text</h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. Maecenas id leo at elit vestibulum sagittis at in ex. Cras vulputate laoreet dictum. Vestibulum nec quam placerat, blandit orci in, hendrerit ante. </p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>test heading text</h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. </p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>test heading text</h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. </p>
Learn more
</div>
<div class="section">
<img src="http://via.placeholder.com/500x400" alt="" width="400" height="300" style="max-width:90%;height:auto;" />
<h2>test heading text</h2 >
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum faucibus turpis, sed blandit mauris bibendum sit amet. Praesent congue enim at orci dapibus accumsan. </p>
Learn more
</div>
</div>
Below is my CSS:
.container:after { /*clear float*/
content: "";
display: table;
width: 100%;
clear: both;
}
.container {
margin-left: 100px;
margin-right: 100px;
text-align: center;
padding-top: 30px;
}
.section {
float: left;
width: 33.3333%;
padding-bottom: 50px;
border: 1px solid;
box-sizing: border-box;
display: table-cell;
}
.section p {
padding-bottom: 50px;
text-align: center;
font-family: "Montserrat", sans-serif;
font-size: 19px;
padding-left: 25px;
padding-right: 25px;
}
.section h2 {
text-align: center;
font-family: "Slabo 27px", serif;
font-size: 24px;
font-weight: 700;
text-align: center;
padding-left: 25px;
padding-right: 25px;
}
#media (max-width: 768px) {
.section {
float: none;
width: auto;
}
}
below is a js fiddle of what I currently have
https://jsfiddle.net/b147rmdh/
Any help on this would be greatly appreciated!
You need to specify a height for each column for them to all be the same height. If you don't then the columns will size themselves based on the amount of content they contain (which is currently what is happening in your code). More specifically relating to your code, if you add a specific height to your .section class, then all the columns should be the same height.
Once you have done this, you could use absolute positioning on all of the elements within the columns (the headers, paragraphs, buttons, etc) so that they all line up. If you aren't very familiar with absolute positioning and the position property in general, here is a great reference that explains positioning well. Definitely recommend giving it a read and taking the time to get a good understanding of positioning since it's one of the most fundamental CSS skills.
I'd suggest a Flexbox with wrapping.
.container {
display: flex;
flex-wrap: wrap;
}
.section {
width: 33.3333%;
}
Once you've done that, you can use a similar method vertically if you wrap the upper content in one element and keep the button separate. Set your flex-direction to column and justify-content to space-between.
I have to apply different styles to p tag which is created under to 2 seprate divs.
.wrapper .extraclass p{
color: green;
}
.wrapper .class1 p{
color: red;
}
<div class="wrapper">
<div class="class1 class2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
<div class="wrapper">
<div class="extraclass class1 class2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
The color for both p's is same. How can I reorganize my css to make this work?
Put you css in this way, so it can override above global css,
.wrapper .class1 p{
color: red;
}
.wrapper .extraclass p{
color: green;
}
.wrapper .class1 p will select all p tags within .class1 if you want to override css of .extraclass p you have to put it after .wrapper .class1 p css
.wrapper .class1 p {
color: red;
}
.wrapper .extraclass p {
color: green;
}
<div class="wrapper">
<div class="class1 class2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<div>
<div>
<div class="wrapper">
<div class="extraclass class1 class2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<div>
<div>
The problem might be that you have both .extraclass and .class1 in the lasp p-tag
Try reorder them so it says " class1 class2 extraclass".
If not then you might have to remove class1 form the last p-tag.
Or you can always put !important behind the "color: red" but I would not recommend this :)
Your CSS was fine.. I just restructured your HTML a bit:
.wrapper .extraclass p {
color: green;
}
.wrapper .class1 p {
color: red;
}
<div class="wrapper">
<div class="class1 class2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
<div class="wrapper">
<div class="extraclass">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum
neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit
massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing
elit.</p>
</div>
</div>
I took out the class1 from extraclass and corrected the unclosed <div>s
Look here: http://codepen.io/anon/pen/ZeRKJZ
Just give the correct priority of style
the below class will override upper class
.wrapper .class1 p{
color: red;
}
.wrapper .extraclass p{
color: green;
}
<div class="wrapper">
<div class="class1 class2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<div>
<div>
<div class="wrapper">
<div class="extraclass class1 class2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<div>
<div>
Your second class definition overrode the first when being applied to p. I recommend having one definition for classes that will always have shared properties (using .wrapper or something else) and peculiar properties in another class or id.
Also, please make better use of indenting and use </div> to close off a div.
.extraclass
{
color: blue;
}
.class1
{
color: red;
}
<div class="wrapper">
<div class="class1">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
<div class="wrapper">
<div class="extraclass">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum neque eu mauris eleifend, eget dapibus diam pulvinar. Curabitur hendrerit massa ut dui ultrices.Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
I was trying to make a simple website for school, but my footer background gets too big.
Here's my HTML
<div class="container-fluid">
<nav>
<ul>
<li>Home</li>
<li>Services</li>
<li>Portofolio</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</nav>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="images/nature.jpg">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<div class="footer">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue. </p>
</div>
</div>
and Here is my CSS if anybody has any idea on how to fix it please tell me
i have tried to change sometihngs but my background keeps showing at the top
background-color:#d2d8e0;
}
nav {
background-color: #64f48a;
float: center;
padding: 20px 0px 0px 350px;
}
nav ul li {
padding: 0px 50px 20px 0px;
display: inline-block;
}
nav ul li a {
color: #f0f0f0;
}
nav ul li:hover {
background-color: black;
}
article {
padding: 0px 0px 0px 50px;
}
article img {
padding: 0px 0px 0px 50px;
}
article h1 {
text-align: center;
font-size: 20px;
padding: 0px 0px 0px 0px;
}
article p {
text-align: center;
font-size: 15px;
}
.footer {
background-color: red;
}
.footer p {
text-align: center;
color: #fff;
}
This is an issue with the float applied to bootstrap columns, you should wrap your columns with a row (See Grid System).
You could also add a display property to your footer like so or add a column to enclose your footer: <div class="col-md-12">.
.footer {
background-color: red;
display: inline-block;
width: 100%;
}
Working Example with add .row div.
nav {
background-color: #64f48a;
float: center;
padding: 20px 0px 0px 350px;
}
nav ul li {
padding: 0px 50px 20px 0px;
display: inline-block;
}
nav ul li a {
color: #f0f0f0;
}
nav ul li:hover {
background-color: black;
}
article {
padding: 0px 0px 0px 50px;
}
article img {
padding: 0px 0px 0px 50px;
}
article h1 {
text-align: center;
font-size: 20px;
padding: 0px 0px 0px 0px;
}
article p {
text-align: center;
font-size: 15px;
}
.footer {
background-color: red;
}
.footer p {
text-align: center;
color: #fff;
padding: 50px 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<nav>
<ul>
<li>Home
</li>
<li>Services
</li>
<li>Portofolio
</li>
<li>Blog
</li>
<li>Contact
</li>
</ul>
</nav>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
<article>
<div class="col-md-4">
<img src="http://placehold.it/150x150/000/fff">
<h1>Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.
</p>
</div>
</article>
</div>
<div class="footer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed mattis erat, dignissim auctor magna. Cras placerat lorem at fringilla dapibus. Cras lobortis nec eros id congue.</p>
</div>
</div>
If you're planning to put a sticky footer at the bottom, you'll need need to add a bottom padding to the body so that it pushes the footer down. You'll also need to make sure you actually set a height on the footer.
If you want to learn more about how to do this, check out this post:
https://css-tricks.com/snippets/css/sticky-footer/
Remove the padding-bottom: 200px; from the .footer p
I have a list of n items.
I'm trying to align the a element having child img, next to sibling p element.
I've tried setting both to display:inline-block, but I don't see any change. My code looks like this:
<li>
<h3>Header 3</h3>
<img src="example.img" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate interdum lacus in hendrerit. Donec libero metus, maximus sit amet.</p>
</li>
My goal is to create a sort of panel where the a element is to the left with the text next to it, and the h3 centered in that same panel.
<li>
<h3>Header 3</h3>
<a href="#">
<img src="example.img" alt="">
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate interdum lacus in hendrerit. Donec libero metus, maximus sit amet.</p>
</li>
I didn't understand what your question goal. But, tell me if my answer was wrong :)
li{
list-style: none;
}
h3{
text-align: center;
}
img{
float: left;
}
p{
text-align: right;
}
<li>
<h3>Header 3</h3>
<img src="example.img" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate interdum lacus in hendrerit. Donec libero metus, maximus sit amet.</p>
</li>
use display:inline-block in a and p and set some width, use text-align:center in h3
body,
h3,
p {
margin: 0;
font-size:16px /* restore font-size inline-block fix*/
}
h3 {text-align: center}
ul {
margin: 0;
padding: 0;
font-size: 0
/*inline-block fix gap*/
}
li {
background: red;
}
a,
li,
p {
display: inline-block;
vertical-align: top;
width: 50%
}
img {
width: 100%;
display: block
}
<ul>
<li>
<h3>Header 3</h3>
<a href="#">
<img src="//lorempixel.com/100/100" alt="">
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate interdum lacus in hendrerit. Donec libero metus, maximus sit amet.</p>
</li>
<li>
<h3>Header 3</h3>
<a href="#">
<img src="//lorempixel.com/100/100" alt="">
</a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate interdum lacus in hendrerit. Donec libero metus, maximus sit amet.</p>
</li>
</ul>
I'm having a big trouble... i cant make a div grow with content...
i've got this HTML to fix it here... but i cant do that... can someone help me with this...??
I Uploaded the link here: http://efdutra.com/help
The div that i need to grow, well.. you will see the Lorem Ipsum getting over the footer... :p
There is some part of the html:
<div id="boxes">
<div id="boxFinal">
<div id="linksBoxFinal">
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed massa felis, accumsan eget mattis sed</li>
</ul>
</div>
<img id="barraFinal" src="img/barraBoxFinal.png" />
</div>
</div>
And here the css:
#boxes{
margin:0;
padding:0;
position:relative;
float:left;
height: 100%;
width: 100%;
overflow: none;
}
#boxFinal{
margin:15px 0 0 8px;
padding:0;
float:left;
position:relative;
width:100%;
max-height:100%;
overflow:inherit;
}
Can someone please help me...?
Having played around with your styles I see a lot of things wrong. Firstly you do not need to float everything left. next you need to add lis to around you anchor tags in the ul. third you need to remove the absolute positioning of #lineBoxFinal. If you use the following styles (replacing your existing ones) then the footer should work properly
//line 241
#linksBoxFinal ul {
margin: 5px 0 35px 15px;
z-index: 3;
}
//line 262
#barraFinal {
position: relative;
margin: 0 110px;
z-index: 2;
clear: both;
}
Thats because position:absolute on div[.linksBoxFinal]>ul
Thats would be in #linksBoxFinal ul on line 241 in your style.css
.
.
try this:
<ul style="position:relative;">
(also, remove the not so needed margin bottom)
as to your question about putting an li inside an anchor, i believe the answer is no. Anchors cannot house block level elements.