Home > front end >  Positioning paragraph in css
Positioning paragraph in css

Time:09-07

So I'm working on a project and have been stuck on positioning for a while. I need the "About Me" text to have the paragraph on the right side of it and to the right of the page.

I am also trying to figure out how to get the "about me" part to stack on top of each other so the "Me" is under the "About" with a thin line going down on the right side that breaks off into the paragraph.

Here is the html code

<body>
    <header>
        <h1>Lerantino</h1>
        <nav >
            <ul>
           <li><a  href="">About Me</a></li>
           <li><a  href=""> Work</a></li>
           <li><a  href="">Contact Me</a></li>
           <li><a  href="">Resume</a></li>
        </ul>
    </nav>
   </header>
    <div >
        <img src="/Images/greenvalley-pictures-IPbClYwlSEA-unsplash.jpg">
</img>
<h2>Cool Subtitle Here!</h2>
</div>
<section>
    <div >
        <h3 >About Me</h3>
    <p >Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sint, quia? nipsum dolor sit amet consectetur, adipisicing elit. Ratione ut veritatis assumenda, harum magnam illum sit earum quia nemo consectetur repudiandae, perspiciatis libero optio quidem quos porro nostrum enim sapiente molestias? Quo aut autem impedit expedita blanditiis aspernatur voluptatum nam. 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 laborum.
    </p>
    </div>
</section>








</body>
</html>

Here is the CSS

body{
    padding: 0;
    margin: 0;
}



header  {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgb(49,52,61);
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-weight: lighter;
  
  
  
}
h1 {
    background-color: rgb(145,203,205);
    padding-left: 60px;
    padding-right: 9px;
   padding-top: 4px;
   padding-bottom: 4px;
   font-size: 40px;
   margin: 0;
    margin-bottom: 8px;
    margin-top: 2px;
  font-weight: lighter;
}

nav {
justify-content: flex-end;
color: rgb(145,203,205);
display: inline-block;
float: right;




}

ul {
  display: flex;
  gap: 1px;
  
}

 ul li {
    color: rgb(145,203,205);
    display: inline-block;
    padding-right: 20px;
    font-weight: bolder;
    margin-right: 20px;
    
 }

 li a {
 color: rgb(145,203,205);
 
 }

 a {
    text-decoration-thickness: 4px;
    text-decoration: none;
    border-bottom: 4px solid;
    
  
 }

 img {
  height: 200px;
  width: 100%;
  
 }
.headerImage h2 {
  float: right;
  position: relative;
  top: -75px;
  right: 50px;
  background-color: rgb(145,203,205);
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 4px;
  padding-right: 4px;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-weight: lighter;
  
 }


 .AboutMeContainer {
     position: relative;
     display: flex;
     justify-content:flex-end;
 }



 .mainheaders {
  color: rgb(101,118,143);
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-weight: lighter;
  font-size: 40px;
  font-weight: lighter;
  
 }

 .aboutMeParagraph {
  
 }

Thank you!

CodePudding user response:

Something like this? I've wrapped the about me and text in a div and added padding to neaten it up. The border-right property has been used to add that line. I've also set the container width to 100%

body {
  padding: 0;
  margin: 0;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgb(49, 52, 61);
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-weight: lighter;
}

h1 {
  background-color: rgb(145, 203, 205);
  padding-left: 60px;
  padding-right: 9px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 40px;
  margin: 0;
  margin-bottom: 8px;
  margin-top: 2px;
  font-weight: lighter;
}

nav {
  justify-content: flex-end;
  color: rgb(145, 203, 205);
  display: inline-block;
  float: right;
}

ul {
  display: flex;
  gap: 1px;
}

ul li {
  color: rgb(145, 203, 205);
  display: inline-block;
  padding-right: 20px;
  font-weight: bolder;
  margin-right: 20px;
}

li a {
  color: rgb(145, 203, 205);
}

a {
  text-decoration-thickness: 4px;
  text-decoration: none;
  border-bottom: 4px solid;
}

img {
  height: 200px;
  width: 100%;
}

.headerImage h2 {
  float: right;
  position: relative;
  top: -75px;
  right: 50px;
  background-color: rgb(145, 203, 205);
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 4px;
  padding-right: 4px;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-weight: lighter;
}

.AboutMeContainer {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.mainheaders {
  color: rgb(101, 118, 143);
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-weight: lighter;
  font-size: 40px;
  font-weight: lighter;
}

.mainheaderscontainer {
  padding-inline: 0.5rem 2rem;
  border-right: 1px solid rgb(101, 118, 143);
}

.aboutMeParagraphContainer {
  padding-inline: 0.5rem;
}
<header>
  <h1>Lerantino</h1>
  <nav >
    <ul>
      <li><a  href="">About Me</a></li>
      <li><a  href=""> Work</a></li>
      <li><a  href="">Contact Me</a></li>
      <li><a  href="">Resume</a></li>
    </ul>
  </nav>
</header>
<div >
  <img src="/Images/greenvalley-pictures-IPbClYwlSEA-unsplash.jpg">
  </img>
  <h2>Cool Subtitle Here!</h2>
</div>
<section>
  <div >
    <div >
      <h3 >About<br> Me</h3>
    </div>
    <div >
      <p >Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sint, quia? nipsum dolor sit amet consectetur, adipisicing elit. Ratione ut veritatis assumenda, harum magnam illum sit earum quia nemo consectetur repudiandae, perspiciatis libero optio
        quidem quos porro nostrum enim sapiente molestias? Quo aut autem impedit expedita blanditiis aspernatur voluptatum nam. 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 laborum.
      </p>
    </div>
  </div>
</section>

  • Related