Utilize h1, h2, and h3 tags alongside proper positioning in an HTML file with the help of a

Check out the HTML code below:

<div class="front-page">
<div id="header" class="mainclass">

<h1 class="secondclass">Main Title</h1>

</div>
</div>

I am curious about how to insert h2 / h3 / h4 inside div:

<div id = "header" class = "mainclass">
?

In addition, I want to customize their positions. For example, h2 will be on the right just under h1, h3 at the bottom right, and h4 at the top right.

Is this achievable?

Any suggestions or help would be greatly appreciated!

Answer №1

Feel free to experiment with this

H1 {
  float: left
}

H2 {
  float: right
}

H3 {
  display: block;
  position: relative;
  top: 150px;
}

H4 {
  display: block;
  position: absolute;
  top: 0px
}
<div class="front-page">
  <div id="header" class="mainclass">

    <h1 class="secondclass">Main Title</h1>
    <h2 class="secondclass">H2</h2>
    <h3 class="secondclass">H3</h3>
    <h4 class="secondclass">H4</h4>

  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to have text centered only on desktop devices and left-aligned on mobile devices using Bootstrap 4?

I have the following code for the header where I want two pictures to be at either end, preferably at the corners. The text should be directly in the center on a desktop, and on mobile, all images and text should be stacked. Is that possible? To view the ...

Looking for guidance on integrating Forms with VueX and script setup? Are you utilizing v-model in your implementation?

UPDATE: I'm contemplating whether or not to abandon VueX entirely due to its outdated status, with Pinia being the preferred choice nowadays. Can someone confirm this? https://stackblitz.com/edit/vue-script-setup-with-vuex-hmrk5d?file=src/store.ts ...

Increase the padding for each child element within its corresponding parent

Is it possible to add padding to child items within each "folder" element without using JavaScript if there is more than one? This scenario would be hardcoded as follows: folder folder inner { padding-left: 14px; } folder folder folder inner { pad ...

Blueprint adjusts the height of the menu

After rendering the following code, the menu appears as a table with the ID topMainMenu and a height of 51. However, upon removing the Blueprint stylesheet, the height of topMainMenu reduces to 20, which I believe is the minimum height. <head runat="se ...

Aligning images in center of list

I'm in need of some CSS expertise to assist with this layout. Here is the current structure: <div class="movieList"> <div class="image" selected = true> <img class="poster" src="image1" selected = true/> </div> <d ...

Animating a background image to slide in from the bottom to the top using CSS transition

Here is a link to a codepen example: https://codepen.io/jon424/pen/XWzGNLe The current effect in this example involves covering an image with a white square, moving from top to bottom when the "toggle" button is clicked. I am interested in reversing this ...

annoying box filled with information

Take a look at my http://jsfiddle.net/8wSzk/2/ <div class="row1"> <div> <div class="circle-menu"> </div> <p> some option </p> </div> <div> <div class="circle-menu"> </div> ...

Transition property in CSS not functioning properly

In my webpage, I have div elements with multiple classes for easy manipulation in jQuery based on their nature. When I try to expand and collapse the div on a button click event, everything works fine except for the transition effect which is not working ...

Ways to configure a select-multiple element to send data as an array

I am experiencing an issue with a form I have set up. Here is the current code: <form method="post" action="action.php"> <select id='select' multiple='multiple'> <option value="1"> Option1 <option> ...

Achieving vertical alignment and stretching of subchild within a flexbox element

I am in the process of creating a mobile navigation menu using Flexbox. It will be a vertical menu that occupies 100% of the available height, with the navigation items evenly spaced and taking up the entire height. The structure I am using is ul>li> ...

Choose children input textboxes based on the parent class during the onFocus and onBlur events

How can I dynamically add and remove the "invalid-class" in my iti class div based on focus events in an input textbox, utilizing jQuery? <div class="form-group col-md-6"> <div class="d-flex position-relative"> & ...

Adjust the size and position of the text input field

I'm struggling to find a way to both resize and move the box without one action interfering with the other. Whenever I attempt to change the size of the box, it triggers the move event at the same time. Clicking on the box should make it resizable, bu ...

Labels arranged in a fixed width format

Is there a way to ensure that the labels for the inputs are all the same width, creating a more cohesive table-like layout? Imagine it as two columns: one for the labels and one for the inputs. Here is the code I have so far: th, td, table{border: 2px ...

Selenium allows the liberation of a webpage from suspension

I'm facing an issue with resolving the suspension of a website as shown in the image below. My goal is to access a ticket selling website every 0.1 seconds, but if it's busy, I want it to wait for 10 seconds before trying again. Visit http://bu ...

What could be causing the discrepancy in functionality between Safari and Chrome for my overlay feature?

After testing the image hover overlay feature on various platforms such as desktop and Android devices, it has come to my attention that it does not function correctly on Safari. Specifically, the feature does not work on Apple devices like iPhone, iPad, a ...

Is it possible to adjust the popup width based on the child classes?

<span class="grandparent"> <span class='parent'> <span id="popUP" class="child1"> Some content for popUP </span> <!-- 1st child has width of 390px--> </span ...

Styling the `mat-hint` in Angular Material for large blocks of text

Currently, I am undertaking a project in Angular 9 and utilizing Material design. If you want to view a demo of my work, you can find it here: https://stackblitz.com/edit/mat-hint-styling-issue?file=src/app/app.component.html In my project, I am using in ...

Show or hide the right element when clicked using ng-show in AngularJS

My goal is to toggle elements based on which one is clicked, not all at once. For instance, if I have 3 form elements and 3 buttons, when I click on button 1, I only want to toggle the corresponding form element. Here is my current code snippet: In Angu ...

Extracting specific text from HTML tags using Python's BeautifulSoup

I'm trying to extract specific tags from two different sections of text using the BeautifulSoup library in Python. Here's what I've attempted so far: g = soup.find_all("dtposted") for tag in g: print(tag) <dtposted>2020<trnamt& ...

What could be causing my click event to only fire once upon generating HTML, but function properly when using console.log?

It seems to be functioning correctly in the console, as well as when generating HTML. However, it only seems to work once with HTML, while it consistently works with the console. Should I consider using a loop here and returning the HTML in that manner? I ...