Tips on reducing the gap between two tags inside a div element

I'm facing an issue with the spacing between a H1 and H2 tags inside a "welcome" div. I want to reduce the gap between the word welcome and the second line of text, but I can't seem to figure it out. Any suggestions on how to solve this simple problem would be highly appreciated. Please refer to the image below for clarification along with my HTML/CSS code.

Here is my HTML code:

<html>
<head>
<meta charset="utf-8">
<title>Playing with backgrounds</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="wrapper">

<a href="index.html">
<div id="logo">
</div>
</a>

<div id="welcome">
<h1>Welcome</h1>
<h2>
To 
<span class="gold"> Promise Land Partners</span></h2>

</div>


<div id="bottom_bar">
</div>

</div>
</body>
</html>

This is my CSS code:

body {
    background-image: url(img/dot.png), url(img/background.jpg);
    background-repeat: repeat, no-repeat;
    background-position: top left, center center fixed;
    background-size: auto, cover;;
    margin: 0px;
    font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}

#logo {
    background-image:url(img/PLP.png);
    background-repeat: no-repeat;
    background-position: top left;
    height: 100px;
    width: 100%;
    margin: 0;
    padding: 0;
}

#logo:hover, #logo:active {
    background-image:url(img/PLP_pushed.png);
}

#bottom_bar {
    background-image:url(img/bottom_bar.jpg);
    position: fixed;
    bottom: 0;
    height: 27px;
    width: 100%;
}

#welcome {
    background-image: url(img/welcomepanel.png);
    background-repeat: no-repeat;
    position: relative;
    left: 0;
    top: 70px;
    height: 261px;
    width: 100%;
    padding: 10px;
    margin: 0;
}

h1 {
    color:white;
    padding-left: 90px;
    font-size: 6em;
    margin: 0;
}

h2 {
    color: white;
    font-size: 4em;
    padding-left: 20px;
    margin: 0;
}

.gold {
    color: #ee9f00;
    font-size: .75em;
    margin: 0;
}

Answer №1

Experiment with using line-height: 0.5em; as a potential solution

Answer №3

Experiment with adjusting the line-height and/or margin

http://example.com/jsfiddlelink123

h1 {
    color: black;
    padding-left: 100px;
    font-size: 5em;
    margin: 0;
    line-height: 1.2;
}

h2 {
    color: black;
    font-size: 3em;
    padding-left: 10px;
    margin: -0.3em 0 0 0;
    line-height: 1;

}

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

Displaying NodeJS error messages directly in the main HTML file

After creating a form using NodeJs and implementing input validations that display errors when users enter incorrect values, I encountered an issue where the errors appear on a new blank page instead of within the main HTML file itself with stylish formatt ...

What is the best way to customize the default identity pages in an ASP.NET React JS application?

After creating an ASP.NET React JS web application (.NET 7.0) with individual user accounts, I utilized the identity scaffold to incorporate the identity .cshtml pages into the 'Areas' folder. My goal was to style the default identity pages by a ...

What is the best way to implement conditional styling in Vue.js?

Looking to incorporate a conditional style into my Component. Here is my component: <site-pricing color="primary" currency="$" price="25" to="/purchase" > <template v-slot:title>Complete</templat ...

Displaying Unicode CSS Font Awesome Icons as Boxes in a React Project

I have incorporated the jPlayer example into a create-react-app. Encountering an issue where font-awesome icons are displaying as boxes in this CodeSandbox illustration. https://codesandbox.io/s/peaceful-heisenberg-d59nz?fontsize=14&hidenavigation=1&a ...

Transforming HTML output into JSON format on Firefox

Currently, I have a JSON file named persons.json that contains information about various individuals. [ {"firstName":"John", "lastName":"Doe"}, {"firstName":"Anna", "lastName":" ...

Incorporating Card Layouts with SwiperJS

Reference Code: See Example on Code Sandbox I am looking to implement a swiper that allows for navigating one slide at a time with a layout where slidesPerView: "auto" and fixed width are used. The first two slides behave as expected, but the la ...

"Utilizing React.js to implement white-space styling on numeric values for

I am a beginner in Reactjs and eager to learn and improve. Here is some code I have been working on: there's an <h1> element with the text "test", and beneath it, I want to display numbers vertically like this: 1:1, 1:2, 1:3. However, the CSS do ...

retrieve the index number of a parent node by utilizing the indexOf.call method in JavaScript

I discovered a unique DOM layout <ul class="main-products"> <li class="product">product</li> <li class="product">product</li> <li class="product">product</li> <secti ...

Verify a document located on another server

My objective is to prompt the user to download a file generated by my script and upload it onto their server (this functionality has been successfully implemented). The purpose of this task is to confirm that the user can indeed upload files to the website ...

The correct CSS file did not load, as it appears that another file from a different location has been

Currently facing an issue with my website. The CSS file located at css/style.css is empty, but it is not loading when the index.php in public_html on cPanel loads. I have added the following link: link rel='stylesheet' type='text/css' ...

Interactive Mini Games - AJAX Edition

If you haven't heard of Microgames before, take a look at this video showcasing WarioWare Twisted. I have a vision of creating a platform where users can engage in a series of browser-based Microgames delivered to them through a server. My goal is to ...

XPath allows for the selection of both links and anchors on a webpage

Currently, I am using Screaming Frog and seeking to utilize XPath for a specific task. My objective is to extract all links and anchors that contain a certain class within the main body content, excluding any links found within div.list. I have attempted ...

Strange Behavior of HTML5 Audio Elements

I'm currently in the process of designing a shop website with a nostalgic Windows98 theme. On the product's page, I want to include a preview of audio. Here is the CSS code that I have used for the HTML5 audio element: audio::-webkit-media-contr ...

What is the rationale behind using :: before display: inline-block in Angular Material MDC's mat-mdc-form-field-error-wrapper, causing substantial padding?

I recently made the switch from Angular Material to Angular Material MDC in preparation for upgrading to Angular 17 from version 15. However, I've noticed that some styles are now broken. One issue I'm facing is a significant padding between the ...

What is the reason this straightforward regex functions perfectly in all cases, except for when applied to the html5

This particular HTML input turns red to signify that the pattern has not matched when the value in the input field is "1". var newInput = document.createElement ('input'); newInput.pattern = '^\d+\.?\d*$'; document.getEl ...

Is there a way to extract the numerical value from a string within an ID of a div and transform the rest of the string into a variable?

Looking to extract the final id of a div and convert it to a variable. <div class="margin_bot" id="itemRows2"> <p id="rowNum1">...</p> <p id="rowNum2">...</p> <p id="rowNum3">...</p> <p id="rowNum4"> ...

Emphasize the cells located in the bottom left quadrant of the table (triangular shape)

I've dynamically created an HTML table with a specified number of rows and columns. The next step is to highlight the cells in the bottom left half of the table with a light red color, forming a triangle pattern similar to the one shown in this link. ...

Editing the content of a div in real-time by dynamically updating the innerHTML

Looking for a way to dynamically change the innerHTML of a contentEditable div using pure JavaScript, without relying on the Rangy library. I want the change to occur on keyup without losing cursor position or focus. Here is an example setup: <div id=" ...

Showing a card overlaying a custom clip-path design

I'm in the process of creating a website similar to the design of DuckDuckGo, featuring a rounded background with cards placed on top: https://i.sstatic.net/RUO45.png However, my current implementation has resulted in the clip-path cutting off the c ...

Utilizing Bootstrap to display selected portions of the list content

I am working with a select element that looks like this: jQuery('.my-select').selectpicker(); .list_img{ width: 30px; height: 30px; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script ...