Ways to create an inline effect for h3 and <hr> elements, or strategies for incorporating a horizontal line following a header

Is there a way to make the H3 and HR elements appear inline? In my design, I want a horizontal line to come immediately after the title without breaking onto the next line like it currently does.

<div class="row">
    <h3 class="col-md-4 col-sm-4 col-xs-6" data-i18n-key="Date.time.location"></h3>
        <hr class="col-md-8 col-sm-6 col-xs-4">
</div>

Answer №1

To make both elements inline, you can enclose the h3 and hr within individual div tags and then assign their classes to the corresponding div:

<div class="line-row">
    <div class="title-block col-md-4 col-sm-6 col-xs-8">
        <h3 data-i18n-key="Date.time.location">Title</h3>
    </div>
    <div class="divider-block col-md-8 col-sm-6 col-xs-4">
        <hr>
    </div>
</div>

Answer №2

To make the h3 and hr inline, you can utilize the (display:inline-block) property. However, I believe the following example will provide more clarity.

.line{
  position:relative;
}

.line:before{
  content:"";
  position:absolute;
  top:50%; /* line position can be changed based on requirements - top:0, top:50%, or bottom:0 */
  left:0;
  width:100%;
  height:1px;
  background:#ccc;
}

.line span{
  display:inline-block;
  background:#fff;
  position:relative;
  padding-right:5px; /* space between text and line */
}
<div class="row">
    <h3 class="col-xs-12 line"><span data-i18n-key="Date.time.location">your text goes here</span></h3>        
</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

Interactive Video Effect

Seeking to create a unique video hover effect on an image where, when the mouse hovers over it, a video pops up similar to examples found on this website. I have been grappling with finding a solution for this issue over the past few months. Does anyone ...

Discover the method to adjust the position of elements, such as images, using radio buttons

I have an image positioned in a container along with 3 radio buttons. I want to make additional images appear over the main image when specific radio buttons are selected. Each button will trigger different positions for the additional images. So far, thi ...

Unusual Behavior of *ngIf and jQuery in Angular 5: A curious case

I'm encountering a strange issue when using the expand-collapse feature of Bootstrap 4 with *ngIf for expansion and collapse. I noticed that the jQuery doesn't work when *ngIf is used, but it works fine when *ngIf is removed. HTML: <div cla ...

What is the best method for creating a draggable widget in HTML, specifically with the use of Angular?

I am searching for an HTML div that is free floating and can be dragged and positioned anywhere on the page without being affected by other elements. It's okay if the element blocks the view of elements below, and it would be great if there is a minim ...

Is it possible to modify the flex direction in Bootstrap based on specific breakpoints?

I am currently utilizing Bootstrap 4 for my project. I have a div that is styled with "d-flex" and it is meant to display as a row at the "lg" breakpoint (screens 1200px and above). However, on smaller devices such as mobile phones at the "sm" or "xs" brea ...

Hover causing opacity problem in CSS

Check out my code snippet on JSFiddle: http://jsfiddle.net/Vbtts/2624/ Here is the HTML structure: <a href="#" class="col-xs-6 col-sm-4 big-container with-background"> <div class="bottom-align"> <label class="upperca ...

What impact does reducing the window size have on my header?

While working on a website with a navigation bar, I encountered an issue where the navbar was not responsive. When the window size was reduced, the nav bar shifted to an awkward position vertically, as shown in the first image. The navbar shifts below the ...

When hovering over individual links within a set of blocks, ensure that the other links are not affected or disrupted

I need help creating a forum category link guide. Similar to this example... Specifically, I want it to display as Forums > The Financial Roadmap Two issues I am facing are: when hovering over the link, it shifts down one row and how can I add blocks ...

Fixed width for the last column in DataTables

Here's the scenario: I have a jQuery script that loads DataTables, and I know how to set the "aoColumns" : "sWidth" parameter to fix the width of a specific column, which is working fine. However, my issue arises from having multiple tables with var ...

Modern UI Styling for ASP.NET MVC with Metro Design

I am interested in incorporating the METRO UI CSS into my application: Begin by creating an ASP NET MVC Project To download METRO UI MVC, follow these steps: Package Manager Console: PM> Install-Package Metro.UI.CSS Adjust the bundles to incl ...

When you hover over it, the text moves above the background content

I am looking to enhance my table by having the text expand and hover over the content with a white background. I have achieved the expand effect, but I am struggling to get the overflow to work properly. You can view the code in action on JsFiddle: JsFiddl ...

Creating a tabular layout using div elements and CSS styling

Here is the css and html code that I am working with: <style type="text/css"> .formLayout { background-color: #f3f3f3; border: solid 1px #a1a1a1; padding: 10px; width: 300px; border-radius: 1em; } ...

Proper alignment of div elements using Bootstrap

I am attempting to align 2 div elements side by side using Bootstrap code: <div class='col-12'> <div class='row'> <div class='col-6'> </div> <div class='col-6&a ...

jQuery plugin: Dynamic text rotator with color transitions

For more information about the jQuery plugin, visit this page: https://github.com/peachananr/simple-text-rotator Here's a link to my Fiddle: https://jsfiddle.net/jzhang172/8msf91wa/ Make sure to check out my external Fiddle link, as the code here ma ...

CSS - Ignoring Padding Causes Unexpected White Space to Appear

I am encountering a simple error, and the following address will direct you to where the issue can be seen. Why is certain parts of the header appearing white instead of the light shade of green it is set to be? It should be positioned right at the top un ...

Angular reduces image width to zero

Looking to include an image in an Angular template, where the width attribute is equal to a variable width that sometimes holds the value null. In cases where width = null, I aim to have width = "" (or no width attribute at all). However, Angular assigns ...

Error message indicating the inability to parse a JSON string into a DateTime object of type org.joda.time.DateTime

Produce.java(Entity class) @Column(name="productionStartFrom") private DateTime productionStartFrom; @Column(name="lastDateForBid") private DateTime lastDateForBid; @Column(name="produceDate") private DateTime produceDate; html code <div class="col ...

What are the steps to create a basic star-rating system?

I attempted to create my own star rating system using HTML and CSS, but encountered issues with its functionality. While solutions like using direction: rtl or float: right worked, I am unable to implement them due to constraints related to PHP. Is there ...

Issue with triggering function within Material UI Tabs

The issue I encountered cannot be replicated, but I attempted to address it. Within a Material UI element, there is a child element that I inserted - an X icon located in the corner. The parent element is the surrounding box. There are two main problems: ...

jquery modal not displaying

My page is designed to display a dialog containing a set of guidelines using a PHP script that determines which guideline(s) should be shown and generates the corresponding div element(s). Afterwards, I utilize a simple $(document).ready( function() { $(" ...