image align left without affecting next div - html

I'm trying to make an informative website about the colosseum with buttons to show/hide text. I put some images with align=left so the information is next to it, but the buttons after the images are being re-aligned to. Here is what it currently looks like:
image
Here is some of the html:
<div>
<div class="buttons">
<div class="murmillo" onclick="changeGladiator('Murmillo')">
Murmillo
</div>
<div class="retiarus" onclick="changeGladiator('Retiarus')">
Retiarus
</div>
<div class="secutor" onclick="changeGladiator('Secutor')">
Secutor
</div>
</div>
<span id="gladiatorTitle"></span>:
<div id="gladiatorDescriptions">
<ul id="murmillo">
<p>
<img align="left" src="images/Murmillo.jpg" width="245px" />
A murmillo typically wears a metal helmet with a stylized fish on the crest, a rectangular shield (scutum),
and a short sword (gladius). The armor worn by a murmillo is designed to protect the head, torso, and legs,
and it is made of metal or leather. The murmillo is one of the most popular types of gladiators in ancient
Rome, and they are often pitted against other types of gladiators, such as the retiarius or secutor.
</p>
</ul>
<ul id="retiarus">
<p>
<img align="left" src="images/Retiarius.jpg" width="245px" />
A retiarius fights using a net, trident, and a small sword called a pugio. Retiarii are often pitted against
secutores, who are armed with a sword and a shield. The retiarius is lightly armed and wears little armor,
so they rely on their speed and agility to evade their opponents. Retiarii are also known for their
distinctive outfits, which include a tunic, a loincloth, and a fish-shaped helmet.
</p>
</ul>
<ul id="secutor">
<p>
<img align="left" src="images/secutor.jpg" width="245px" />
Secutors are heavily armed and trained to fight other gladiators, typically a murmillo or a retiarius. Their
armor and weaponry are designed to mimic those of a soldier, and they are known for their strong, muscular
build. They are also characterized by their helmet, which has a narrow opening that limits their vision and
makes them more reliant on their other senses. The secutor's helmet also has a crest that is shaped like a
fish, which gives them their name (secutor is Latin for "pursuer").
</p>
</ul>
</div>
</div>
<div>
<div class="buttons">
<div class="snacks" onclick="changeOther('Snacks')">
Snacks
</div>
<div class="celebrities" onclick="changeOther('Celebrities')">
Celebrities
</div>
<div class="other events" onclick="changeOther('Other Events')">
Other Events
</div>
</div>
<span id="otherTitle"></span>:
<div id="otherDescriptions">
<ul id="snacks">
<li>Olives</li>
<li> Fruits:
<ul>
<li>Figs</li>
<li>Grapes</li>
<li>Cherries</li>
<li>Blackberries</li>
<li>Peaches</li>
<li>Plums</li>
<li>Melons</li>
</ul>
</li>
<li> Nuts:
<ul>
<li>Walnuts</li>
<li>Hazelnuts</li>
<li>Pine Nuts</li>
</ul>
</li>
</ul>
<ul id="celebrities">
<li>Built during the reign of the Flavian emperors</li>
<li>In construction under Emperor Vespasian's Reign</li>
<li>Emperor Titus celebrated the opening day with 100 days of glagiatorial games</li>
<li>Emperor Commodus performed in arena</li>
</ul>
<ul id="other events">
<li>Dramas</li>
<li>Reenactments</li>
<li>Performances</li>
</ul>
</div>
</div>
And the css:
html, body {
height: 100%;
width: 100%;
margin: 0px;
overflow: hidden;
overflow-y: scroll;
background: linear-gradient(125deg, #FFCA00 0%, #FFA000 100%);
}
.title {
width: 100%;
background-color: #000000;
border-radius: 0 0 70px 70px;
color: white;
font-size: 5rem;
text-align: center;
}
.body {
margin: 50px 10%;
font-family: Arial, Helvetica, sans-serif;
}
.buttons {
display: flex;
position: relative;
right: 15px;
column-gap: 31px;
padding-bottom: 27px;
}
.buttons>* {
cursor: pointer;
background: black;
width: auto;
display: inline;
border-radius: 50px 50px 50px 50px;
padding: 10px;
color: white;
}
img:not(.title>img){
padding-right: 25px;
border-radius: 20px 20px 20px 20px;
}
Any idea on what I could do?

Wrap your divs somehow like this:
<div class="container">
<div class="image-wrapper">
<img src="" alt="">
</div>
<div class="text-wrapper">
<p>Upper description text</p>
<div class="buttons-description-wrapper">
<!-- buttons with the description they are supposed to show -->
</div>
</div>
</div>
And then the CSS would be something like this
.container {
display:flex;
flex-direction:column;
/*use those for general layout*/
/*use the following for some better positioning*/
justify-content:center; /*to center it horizontaly*/
align-items:flex-start /*to align items to the top within this container*/
}
/*setting height properties on wrappers might be needed, depends on how much text are goiing to be displaying*/
Try this and let me know.

Related

How do I give the main section of my site a 2 column layout so that it looks good?

Below I will add my HTML and CSS code. I want to give my page a 2 column layout within the main section. Any help is much appreciated. The navigation, footer, and title part will be the same on each page. I just need the two-column on the main section.
HTML
<!DOCTYPE html>
<head>
<title>Augie's Custom T-shirts</title>
<meta charset="utf-8">
<link href="Style.css" rel="stylesheet">
</head>
<body>
<nav class="nav">
<div class="menu">
<p>Home</p>
</div>
<div class="menu">
<p>Shop</p>
</div>
<div class="menu">
<p>Events</p>
</div>
<div class="menu">
<p>Contact Us</p>
</div>
<br/>
<br/>
</nav>
<main class="wrapper">
<div class="banner">
<h1><span class="name">Augie's Custom T-shirts</span></h1>
<h2>Custom T-shirts for you or your party.</h2>
<div class="bulletPoints">
<ul>
<li>Birthday parties</li>
<li>Vacation groups</li>
<li>Bachelorette Parties</li>
<li>Family reunions</li>
<li>Work team rewards</li>
<li>Business promotions</li>
</ul>
</div>
<br/>
</div>
<p id="Catch">
Do you have an event coming up, and want everyone to get in the spirit? T-shirts can bring a group together, make everyone feel connected, and let everyone know what you're celebrating.
</p>
<p>T-shirts can also be a great gift to someone that acknowledges their special interest or hobby.</p>
<p>Choose from one of our unique designs, or let us put your own design on a shirt for you.</p>
<div class="row">
<div class="column">
<img src="images/gorilla.jpg" alt="Gorilla" style="width:100%">
</div>
<div class="column">
<img src="images/pink.jpg" alt="Pink" style="width:100%">
</div>
<div class="column">
<img src="images/skull.jpg" alt="Skull" style="width:100%">
</div>
</div>
<p><strong>How it works:</strong></p>
<p>Browse our selection of unique designs, select the size and colors of the shirts you would like, and place your order. We will ship your shirts within three business days for in-stock shirts, or five days for custom size and colors.</p>
<figure>
<img src="images/t-shirt-colors.jpeg" alt="T-shirt colors" class="image1">
<figcaption>Choose from are variety of t-shirt colors!</figcaption>
</figure>
<p>Have a design of your own? Can't find the right sentiment? Call or email us to discuss the possibilities or get some ideas for your event.</p>
<p>Please note there will be a one time $15 charge for any custom graphics design.</p>
<h2><em>Contact us today!</em></h2>
</main>
<footer class="footer">
<div class="box">
<p>Augie's Custom T-shirts</p>
<p>(478) 555-1212</p>
<p>augieB#augiesTees.com</p>
<br/>
</div>
<div class="box">
<p>Check out are Social Media for updates!</p>
<p>Facebook:</p>
<p>Instagram:</p>
<p>Twitter:</p>
</div>
<div class="box">
<p>Locations:</p>
<br/>
<p>100 Tanger Dr, Locust Grove, GA</p>
<p>2954 Watson Blvd Suite 100, Warner Robins, GA</p>
</div>
</footer>
<div class="copyright">
<h3> #copyright: Landon Byrd</h3>
<p>Fall 2021, All Rights Reserved</p>
</div>
<p>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px"
src="http://jigsaw.w3.org/css-validator/images/vcss"
alt="Valid CSS!" />
</a>
</p>
</body>
CSS
/*
Landon Byrd
Fall 2021
Plain Red #f60d41
Rich Red #f6130d
Orioles Orange #f64d0d
Sunset Orange #f6870d
Golden Yellow #f6c10d
*/
/* Global settings */
h1 {text-align: center; font-family: Papyrus}
h2 {text-align: center; color: #f6130d; text-decoration: underline}
.wrapper{width:85%; margin:0 auto; max-width: 960px;}
/* Nav Section */
.nav{width: 85%; margin:0 auto; background-color: #f6130d; text-align: center;}
.menu{float:left; width: 25% }
/* Main section */
.banner{justify-content: center; background-color: #f6c10d; text-align: center;}
.bulletPoints ul {
display:inline-block;
text-align:left;
}
section{background-color: #f6870d; color: #f60d41; font-style:italic; margin: 25px 50px 75px;}
body {
background-image: url("images/background.jpeg");
}
.image1
{
display: block;
margin-left: auto;
margin-right: auto;
}
figcaption {
text-align: center;
}
.row {
display: flex;
}
.column {
flex: 33.33%;
padding: 5px;
}
/* Footer section */
* {box-sizing: border-box;}
.footer{text-align: center; background-color: #f6130d; color: #f6c10d; }
.box{float:left; width: 33.33% }
.footer::after {content: ""; clear:both; }
/* Copyright section */
.copyright {text-align: center; background-color: #f6130d; color: #f6c10d; }
I would also like to make sure all my floats are cleared as nessicary.
It's very easy with flex.
In 2021 you should try to avoid floats as much as possible.
Simply switch to flex as described here:
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
As for your specific case:
.flex-container{
display:flex;
width:100%;
}
.col{
max-width:50%;
flex: 0 0 50%;
}
<div class="flex-container">
<div class="col">
col 1
</div>
<div class="col">
col 2
</div>
</div>
If you want to make them go vertically on mobile, just give the container the property flex-direction:column and make the 2 divs max-width:100% and flex:0 0 100%;

Element is acting as if it has fixed positioning

so I've been looking around for the solution to this problem and I haven't been able to find a clear or really any answers at all (maybe I just don't know how to word the question?). So, I'm really going to rely on pictures for this question and then explain what is going on.
Starting position of chrome dev tools
Above is the starting position of the element (the content just above the dev tools). At this position, the elements are functioning as they should, however on resizing the dev tools, the elements move up or down. In the next picture, I increased the size of the dev tools and the elements in question move with the tools.
Expanded size of chrome dev tools
As you can see in the picture above, when I resize the dev tools, the page elements and next button moves almost like it's attached to the dev tools.
What really confuses me is that I haven't used css on any part of the in questioned elements. And what confuses me even more is the fact that no other element on the page reacts the same way as the element in question (which again is the very last elements on the page).
Below is my html and SCSS code:
HTML:
<section class="section__shopping-items quarter-margin">
<div class="item-content flex-wrapper">
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
</div>
</section>
<section class="section__next-page quarter-margin">
<div class="flex-wrapper space-flex">
<div class="page--select">
<div class="flex-wrapper">
<p>Page:</p>
<div class="select-page flex-wrapper">
<p class="page--num">1 <span>⌄</span></p>
<p class="page--length">of 9</p>
</div>
</div>
</div>
<div class="page--next">
<button class="next">next</button>
</div>
</div>
</section>
SCSS
// shopping items
.section {
&__shopping-items {
height: 100%;
.item-content {
cursor: pointer;
justify-content: space-between;
overflow: auto;
.shop-list {
border: .1rem solid transparent;
min-width: 25%;
// height: 25%;
img {
width: 100%;
}
.item-info {
// margin: 1rem 1rem 2rem 1rem;
margin: 0 1rem;
.gender-collection {
margin: 1rem 0;
font-size: 1.2rem;
font-weight: 100;
color: $collection-name-font;
}
.item {
&--name,
&--price {
font-weight: 300;
}
&--name {
margin-bottom: .7rem;
font-size: 1.3rem;
}
&--price {
margin-bottom: 2.5rem;
font-size: 1.2rem;
}
&--colors {
margin-bottom: 1rem;
font-size: 1.1rem;
font-weight: 300;
color: $collection-name-font;
}
}
}
}
}
.shop-list:hover {
border: .1rem solid $font-color;
}
}
}
Also a quick side note, I've not set anything on this page to position:fixed.
Any help or feedback would be greatly appreciated.

Applying image to grid

I have a grid layout. I'm trying to apply an image to the box on the left. It only fills 3 quarters of the box and leaves space at the bottom. Is there any way I can get the image to fill the entire div and be responsive as it should. I initially wanted to add a slideshow which was the same problem. Also, my other issue is the 4 smaller boxes. The text falls outside of the boxes when making the screen smaller. Hoping someone has positive feedback for me :)
I tried to extend the height of the image but obviously distorts the image
<!-- run local host
1) cd and drag drop file
2) type: python -m SimpleHTTPServer 8080
3) browser type: http://localhost8080
-->
<!-- to make a comment: cmd and / -->
<!-- to shift a section cmd + ] on mac or CTRL + ] on wondows -->
.grid {
display: grid;
grid-template-columns: 6fr 2fr 2fr;
grid-template-rows: 200px 200px 400px;
grid-gap: 20px;
grid-template-areas:
"one two three"
"one four five"
}
.grid > article {
border: 1px solid #ccc;
box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.3);
}
.grid > article img {
max-width: 100%;
}
.text {
padding: 0 20px 20px;
}
.text > button {
background: gray;
border: 0;
color: white;
padding: 10px;
width: 100%;
}
.text > h3 > {
text-align: center;
}
<!-- wrapper start -->
<!-- header start -->
<div class="wrapper">
<div class="header">
<!-- nav bar -->
<ul class="nav-container">
<li>Home</li>
<li>About</li>
<li>Articles</li>
<li>Contact</li>
<li>Login</li>
</ul>
<!-- nav bar -->
<header id="top" class="top-image">
<h1 style="color: white">Code To Program</h1>
<p style="color: white">Web Design | SEO | Tutorials</p>
Contact Us
</header>
</div>
<!-- header finish -->
<!-- header 2 start -->
<div class="header-2">
<h2 style="color: lightslategrey; font-size: 3rem; text-align: center">Our Services</h2>
</div>
<!-- header 2 finish -->
</style>
<div class="container">
<main class="grid">
<article class="one" style="height: 420px">
<img class="imgs" src="img/pdx.jpg">
</article>
<article class="two">
<div class="text">
<h3>2 Web Design</h3>
<figure>
<img src="img/seo.png" alt="Smiley face" height="72" width="72">
</figure>
</div>
</article>
<article class="three">
<div class="text">
<h3>3 SEO</h3>
<p>Dramatically engage seamlessly visualize quality intellectual capital.</p>
<button>Read more</button>
</div>
</article>
</br>
<article class="four">
<div class="text">
<h3>4 Blog</h3>
<p>Dramatically engage seamlessly visualize quality intellectual capital.</p>
<button>Just do it...</button>
</div>
</article>
<article class="five">
<div class="text">
<h3>Tutoring</h3>
<p>Dramatically engage seamlessly visualize quality intellectual capital.</p>
<button>Here's why</button>
</div>
</article>
</main>
</div>
Back to top »
<script src="accordian.js"></script>
<footer style="background-color: brown">
<p>This is the footer</p>
<p>© 2019 Desmond Dallas</p>
</footer>
You are looking for object-fit.
This will solve your problem:
.grid > article img {
height: 100%;
width: 100%;
object-fit: cover;
display: block;
}

How do I position an image on each side of a header?

I'm trying to add a picture of a tree on each side of my header, however I cannot figure out how to position the images correctly to where they are both above my navigation bar and positioned to the left and right of my header.
This jsfiddle shows it a bit better than the snippet.
https://jsfiddle.net/1qghboyh/
* {
margin: 0px;
padding: 0px;
}
header {
padding: 1em;
color: white;
background-color: #323241;
clear: left;
text-align: center;
}
footer {
background-color: #339966;
-webkit-box-shadow: -1px 1px 15px 3px rgba(31,31,31,1);
-moz-box-shadow: -1px 1px 15px 3px rgba(31,31,31,1);
box-shadow: -1px 1px 15px 3px rgba(31,31,31,1);
padding: 1em;
color: white;
background-color: #323241;
clear: left;
text-align: center;
}
.initials {
float: left;
opacity: .25;
}
.tree1 {
float: left;
width: 100px;
height: 100px;
}
.tree2 {
float: right;
width: 100px;
height: 100px;
}
.navigation-bar {
-webkit-box-shadow: -1px 1px 15px 3px rgba(31,31,31,1);
-moz-box-shadow: -1px 1px 15px 3px rgba(31,31,31,1);
box-shadow: -1px 1px 15px 3px rgba(31,31,31,1);
height: 3.2em;
background: #339966;
text-align: center;
border-top: 2px solid;
border-bottom: 2px solid;
}
.navigation-bar ul {
display: inline-block;
list-style-type: none;
}
.navigation-bar li {
display: inline;
}
.navigation-bar li a {
color: white;
padding: 0px 30px;
margin: 1em 0 0 -2px;
text-decoration: none;
float: left;
height: 1.2em;
line-height: 1.2em;
}
.navigation-bar li a.active{
color: #111;
}
.navigation-bar li a:hover, a:focus {
color: #111;
}
.columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
}
.carousel-inner > .item > img, .carousel-inner > .item > a > img {
width: 70%;
margin: auto;
}
.div1 {
width: 100%;
padding: 10px;
border-right: 2px solid;
border-left: 2px solid;
margin: 0;
background-color: white;
}
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
<html>
<head>
<link rel="stylesheet" href="settings.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body style="background-color: #323241">
<header>
<div class="initials">#2 - C.C.</div>
<img src="tree.jpg" class="tree1">
<h1>Landscaping Company</h1>
<img src="tree.jpg" class="tree2">
</header>
<div class="navigation-bar">
<div id="navigation-container">
<ul>
<li><a class="active" href="home.html">Home</a></li>
<li>Gallery</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</div>
<br>
<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="img_chania.jpg" alt="Chania" width="460" height="345">
<div class="carousel-caption">
<h3>Chania</h3>
<p>The atmosphere in Chania has a touch of Florence and Venice.</p>
</div>
</div>
<div class="item">
<img src="img_chania2.jpg" alt="Chania" width="460" height="345">
<div class="carousel-caption">
<h3>Chania</h3>
<p>The atmosphere in Chania has a touch of Florence and Venice.</p>
</div>
</div>
<div class="item">
<img src="img_flower.jpg" alt="Flower" width="460" height="345">
<div class="carousel-caption">
<h3>Flowers</h3>
<p>Beatiful flowers in Kolymbari, Crete.</p>
</div>
</div>
<div class="item">
<img src="img_flower2.jpg" alt="Flower" width="460" height="345">
<div class="carousel-caption">
<h3>Flowers</h3>
<p>Beatiful flowers in Kolymbari, Crete.</p>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="div1">
<div class="columns">
<p>As Northeast Ohio Landscapers, Hemlock Landscapes has been caring for customers and their properties throughout the Chagrin Valley since 1981.
Our core values:
Bring a positive attitude with you each and every day
Work hard, pitch in, be helpful and productive
Be fair and respectful with all people in all encounters</p>
<p>When it comes to Residential Landscape Maintenance in Northeast Ohio, we have a pretty simple mission.
Our mission is to unite people in positive relationships to improve lives.
This includes not only our great customers but also our fantastic employees and vendors that we work with each and every day. If we are not improving your life then we are not living up to our mission.
Experienced in every facet of the landscape industry, we fulfill our one company… total care philosophy by meeting your every need in the following areas:
Residential Landscape Maintenance
Landscape Design/Installation
Plant Health Care</p>
<p>Whether you are new to the Chagrin Valley, switching landscape service providers, or need to add a service to your existing account, Hemlock Landscapes makes it easy for you.</p>
<p>As Northeast Ohio Landscapers, Hemlock Landscapes has been caring for customers and their properties throughout the Chagrin Valley since 1981.
Our core values:
Bring a positive attitude with you each and every day
Work hard, pitch in, be helpful and productive
Be fair and respectful with all people in all encounters</p>
<p>When it comes to Residential Landscape Maintenance in Northeast Ohio, we have a pretty simple mission.
Our mission is to unite people in positive relationships to improve lives.
This includes not only our great customers but also our fantastic employees and vendors that we work with each and every day. If we are not improving your life then we are not living up to our mission.
Experienced in every facet of the landscape industry, we fulfill our one company… total care philosophy by meeting your every need in the following areas:
Residential Landscape Maintenance
Landscape Design/Installation
Plant Health Care</p>
<p>Whether you are new to the Chagrin Valley, switching landscape service providers, or need to add a service to your existing account, Hemlock Landscapes makes it easy for you.</p>
</div>
</div>
</div>
<br>
<footer>Copyright © Landscaping Company</footer>
</body>
</html>
Have you tried putting the img tags within the h1 tag and remove the floats from the images?
<h1><img src=...>Landscaping Company<img src=...></h1>
If you really want to use floats, then I've found that specifying the right float first in the HTML usually produces the desired result.
<img src="tree.jpg" class="tree2">
<img src="tree.jpg" class="tree1">
<h1>Landscaping Company</h1>
As the tree is not actually "content" and more a decoration I would set it as a background image using CSS. Any screen readers etc won't be confused by a meaningless image tag with no alt attribute.
h1::before, h1::after
{
content:'';
background-image: url(http://placekitten.com/g/100/100); /*use tree here*/
width:100px;
height: 100px;
display:inline-block;
}
h1::before
{
float:left;
}
h1::after
{
float:right;
clear:right;
}
h1
{
text-align: center;
height:100px;
line-height:100px;
}
<h1>Some Content</h1>
For one outcome you could use:
<header>
<div class="initials">#2 - C.C.</div>
<div style="display: inline-block;float: left;">
<img src="tree.jpg" class="tree1">
</div>
<div style="display: inline-block;float: right;">
<img src="tree.jpg" class="tree2">
</div>
<h1 style="margin: .67em;">Landscaping Company</h1>
</header>
Corrections and explanations:
Your images were just plainly positioned inside the <header> container. That really limits what you can actually do with them, so I recommend you to always wrap them up a container. Moved them to their respective container.
After moving the images to their container, I cleared the block level behavior of the <div>'s by setting them to have a display: inline-block. Then I transferred the float properties to each of them respectively.
The <h1> tag has two CSS properties comming from bootstrap.css that override normalize.css setting for the margins. I modified it to be .67ems again, and the images fitted just perfectly along with the header.
The second image was positioned below the <h1> tag, so it was being pushed down by the header, because it has a block-level behavior. Be careful with the layout of your elements to avoid these kind of problems. Just FYI; (extracted from MDN Re; Block-level elements):
Browsers typically display the block-level element with a newline both before and after the element. You can visualize them as a stack of boxes.
Now, if what you actually want is this:
Modify your code to be like this instead:
<header>
<div class="initials">#2 - C.C.</div>
<div id="header-imgs">
<div>
<img src="tree.jpg" class="tree1">
</div>
<h1>Landscaping Company</h1>
<div>
<img src="tree.jpg" class="tree2">
</div>
</div>
</header>
Remove the floats from the images, and add the following CSS:
div#header-imgs, div#header-imgs > h1, div#header-imgs, div#header-imgs > div {
display: inline-block;
}
This second form works because of the following:
You are wrapping all elements in a single container, which have them go in the correct order in the DOM Flow (img 1 goes before the header, the header before img 2 and you can guess the last one).
Removing the floats will return the images to the DOM Flow. Also just FYI (again), if the floated elements are the only child of their parent containers, then this will collapse said parent. This leads to horrible headaches if you ever have to check for broken layout here that is screwing up a whole project (say, HTML designed letters).
The display: inline-block will have all three elements stacked at the same level, and they will keep the block behavior that lets you do marvels with them (e.g. top-bottom margins).
Adding display:inline attribute to the header tag will give you the expected,try This
h1
{
display : inline;
}

I can't the col in this footer out

This is what I'm trying to do, in between the two pink lines is my max width.
This is what I'm getting:
I'm getting close:
This is my HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-sm-6">
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
<div class="row">
<div class="col-md-2">
<img src="img/FB_LINK.png" alt="Follow us on Facebook"></div>
<div class="col-md-2">
<img src="img/TWITTER_LINK.png" alt="Follow us on Twitter"></div>
<div class="col-md-2">
<img src="img/LINKEDIN_LINK.png" alt="Link In with Us"></div>
</div>
<div class="row">
<div class="col-sm-6"><h7>© 2016 COPYRIGHT LINE</h7></div>
</div>
</div>
</div>
</footer>
This is my CSS for this section:
footer {
height: 60px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
footer.a{
display:inline-block;
margin:0 auto 0 auto;
}
h7{
color:#FFF;
font-size:24px;
font-family: 'Contrail One', cursive;
text-align:center;
}
I can't seem to figure this out, I've drawn it out on a couple sheets of paper, but I can seem to style like like I'd like. Can anyone point out where I'm going wrong?
After trying your the posted code I found that you are using wrong quote pair.
Also the css you gave isn't designed to achieve the goal.
I made a working fiddle here. Check it out
HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-md-6 parent">
<p>GET SOCIAL WITH US!</p>
<div class="icon">
<img src="https://myapnea.org/assets/myapnea/icons/facebook_icon-7eedcb8837293505e1d3b1494ff19c9c3842340d1dfcd193e098e2b44f34456b.png" alt="Follow us on Facebook">
<img src="http://frcgamesense.com/dnn/portals/0/Home/Twitter_icon.png" alt="Follow us on Twitter">
<img src="https://store-images.s-microsoft.com/image/apps.36749.9007199266245564.6701eae8-16d2-4ba0-bdaa-8d9d9f9a1e70.03e5f6a9-3866-4ad9-9f2b-6b57ff90419e?w=100&h=100&q=60" alt="Link In with Us"></div>
</div>
<div class="col-md-6">
<p class="copyright">© 2016 COPYRIGHT LINE</p>
</div>
</div>
</div>
</footer>
CSS:
footer {
padding: 5px;
height: 100px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
.copyright {
padding-top: 40px;
}
footer p {
color: #fff;
}
footer a img {
display: inline-block;
width:50px;
}
.parent .icon {
margin: auto 7px;
}
It looks like your second col-sm-6 is nested too deep. It should be at the same level of the other one, not within it. Your divs are all sitting on half the grid (6 wide) and then the three social logos are taking half of that, and the copyright bit is taking the other half. You need the col-sm-6 divs to be siblings.
Furthermore, I don't think col-sm-6 looks like it'll work, looking at what you're trying to achieve. You might want to make the first group col-sm-3 or so and add an offset class to the copyright part. :-)
There are at least 3 errors in your HTML markup:
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
The ending quote should be double ("), not single (')
Since you place it in a column, the class name of this tag should be container-fluid, not container
</div>
<div class="row">
<div class="col-sm-6">
Missing close tag, the div .row is not neccessary.
</div>
</div>
</div>
<div class="col-sm-6">
Please see the fixed code here