Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image moving when adding new content to <h1>

Tags:

html

css

First website here (just a heads up)! My problem is that I'm trying to put my content (Flying Fish Painting & Maintenance with Service link below) all in the h1 category without moving the images! I would really like for the two images (on the left and right) to stay in the top left and top right corner respectively when I add the Services href link. Any ideas? Here is my code:

.round1 {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  width: 70px;
  height: 70px;
}

.round2 {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  width: 70px;
  height: 70px;
}

.linkto {
  color: white;
  font-size: 60%;
  font-family: Arial;
}

.linkto:hover {
  color: blue;
}

body {
  padding: 20px 20px 20px 20px;
}

h1 {
  color: white;
  border: 6px solid black;
  border-radius: 25px;
  text-align: center;
  font-family: Forte;
  font-weight: bold;
  background-color: black;
  font-size: 180%;
  padding-bottom: -50px;
}
<h1>
  Flying Fish Painting &amp Maintenance</br>

  <img class="round1" src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291" align=left>

  <img class="round2" src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291" align=right>

  <a class="linkto" href="C:\Users\CE User\Desktop\services.html">Services</a>
</h1>
like image 576
Joe Linnemeier Avatar asked Oct 30 '22 00:10

Joe Linnemeier


1 Answers

First of all, Instead of cramming everything inside an H1 tag, you could put the content in separate divs and then use flex-box to align them. Why not in H1 tag? It's meant for headings

There's so many ways how to accomplish what you're aiming for, this is just one of them

/*
 More about box-sizing:
 https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
 https://www.paulirish.com/2012/box-sizing-border-box-ftw/
*/

html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

.wrapper {
  background: black;
  border-radius: 25px;
  text-align: center;
  padding: 1rem;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  /* could be any number you want */
  max-width: 780px;
  
}

.image-wrapper {
  flex-basis: 70px;
}

img {
  max-width: 100%;
}

h1 {
    text-align:center;
    font-family:Forte;
    font-weight:bold;
    color: white;
    margin: 0 1rem 0 1rem;
}

a {
  color: white;
  text-decoration: none;
  font-size: 1.5rem;
  font-family:Arial;
}

a:hover { color: blue }
<div class="wrapper">
  <div class="left image-wrapper">
    <!-- removed the align attribute -->
    <img src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291">
  </div>
  <div>
    <h1> Flying Fish Painting &amp Maintenance</h1>
    <a class ="linkto" href="C:\Users\CE User\Desktop\services.html">Services</a>
  </div>
  <div class="right image-wrapper">
    <img src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291">
  </div>
</div>
like image 162
VilleKoo Avatar answered Nov 15 '22 11:11

VilleKoo