By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Css styling: how to have picture and text next to each other


Well-Known Coder
Hey there!

Hope you can help me (I am sure you can as usual! :))

I want to make a design identical to first screenshoot (the picture with the dog in) (Not the same font-family, though).

I made the design with the mountain. I don't know how to move the header and the paragraph up next to the picture. It is like display: inline-block is not working. at least no on the paragraph and for the header I cannot move it up using margin-top:


[CODE lang="css" title="HTML and CSS"]<!DOCTYPE html>
<meta charset="utf-8">
<title>hey there</title>
<!--font 'Open Sans'-->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
<!--font 'JetBrains Mono''
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap" rel="stylesheet">-->
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap" rel="stylesheet">

<script src="https://unpkg.com/typewriter-effect@latest/dist/core.js"></script>


h1 {
color: rgb(239, 61, 74);
line-height: 55px;
margin-left: 200px;
font-size: 40px;
line-height: 1.2;
margin-top: 0px;
display: inline-block;

h1 span {
background-color: rgb(38, 102, 145);
display: inline;
font-family: "JetBrains Mono", Sans-serif;
text-align: right;
display: inline-block;

.header:hover {
color: rgb(50, 142, 168);

p {
font-family: "JetBrains Mono";
margin-right: 150px;
margin-left: 200px;
line-height: 1.5;
font-size: 17.5px;
display: inline-block;

img {
width: 500px;
height: 500px;
margin-left: 200px;
margin-top: 100px;


<!--Grundprincip !1-->

<img src="bjerg.jpg" alt="Girl in a jacket">

<h1> <span class ="header">OM OS</span></h1>

<p> <span><strong>Det indre panel af Røvhuller</strong> er en koncept hvor</span></p>






  • Skærmbillede 2021-01-07 kl. 21.02.30.png
    Skærmbillede 2021-01-07 kl. 21.02.30.png
    2.2 MB · Views: 5
  • Skærmbillede 2021-01-07 kl. 21.03.10.png
    Skærmbillede 2021-01-07 kl. 21.03.10.png
    1.6 MB · Views: 5
Yeah that worked. Thanks!

Uff I just have a really hard time understanding flexbox..haha:x3::x3:

What you could try; put the image and text within the same container and then in CSS set the image to float left or right depending on which side you want it to float to.

Note: all content that you want to be displayed e.g. <p>, <img> should be placed within your <body> tag.
For example, a container with display: flex; will automatically set the position of its children so they are placed next to an other, in a row. We can configure it so it place the elements at the right, bottom, centered...

New Threads

Buy us a coffee!

Top Bottom