Achieving a slanted line in full screen using bootstrap

Currently, I am working on creating a slanted line that stretches across the entire page. However, there seems to be a small gap on both the left and right margins of the line.

Here is the HTML code:

    <div class="container-fluid">   
  <div class="row shine">
        <div class="col-lg-7 shine-content text-center">
            <h3>No.1 Bestseller</h3>
            <h1>Rouge Volupte Shine</h1>
            <p>Satin finish. Iconic lipstick. Highly pigmented. A wardrobe of iconic colors that symbolises audacious feminine strength.</p>
    </div>
      
        <div class="col-lg-5 shine-img d-flex justify-content-center px-5">
        
        </div>
    </div>
    
    <hr>
    
<div class="container-fluid">       
    <div class="row rouge">
        <div class="col-lg-6 rouge-img d-flex justify-content-center px-5">
      
          
        <div class="col-lg-6 rouge-content text-center">
            <h1>Rouge Pur Couture</h1>
            <p>In just one stroke, luxurious and highly pigmented colour dresses the lips with a radiant satin finish. Rouge Pur Couture delivers the promise of edgy style and ultimate feminine strength. </p>

        </div>
    </div>
</div>

And this is the CSS code:

hr{
    margin:100px 0;
    border: 0;
    border-top: 2px solid #777777;
    position: relative;
    transform: rotate(-5deg)
}   

You can view the demo here: https://codepen.io/jl-joey/pen/OJXdGJP

Answer №1

One issue is the default margin set by the browser on the body element. To fix this problem, adjust the body margin to 0px, slightly scale the line, and then hide overflow for the container-fluid.

hr{
    margin:100px 0;
    border: 0;
    border-top: 2px solid #777777;
    position: relative;
    transform: rotate(-5deg) scale(1.05);
    
}   
body{
  margin:0px;
}
.container-fluid{
  overflow:hidden;
}
<div class="container-fluid">   
  <div class="row shine">
        <div class="col-lg-7 shine-content text-center">
            <h3>No.1 Bestseller</h3>
            <h1>Rouge Volupte Shine</h1>
            <p>Satin finish. Iconic lipstick. Highly pigmented. A wardrobe of iconic colors that symbolises audacious feminine strength.</p>

Answer №2

To ensure your CSS file is properly styled, be sure to add the following code for the body tag: body{margin: 0;padding: 0;}

Additionally, when styling your hr tag, include the margin values as shown below:

hr {margin: 100px -5px; add any additional styles here}

Keep in mind: Feel free to adjust the right and left margin values (-5px) according to your specific design needs.

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

Enhancing the Bootstrap container using JavaScript

I am working with a Bootstrap container: <div class="container"> <div class="jumbotron"> <div class="row"> <div class="col-lg-8"> <form action="upl ...

Creating a menu with items and listeners from a kmllayer - a step-by-step guide

Currently, I am working with a map that includes a kmllayer. This layer has been added using the following code: ctaLayer = new google.maps.KmlLayer('http://www.npd.no/engelsk/cwi/pbl/en/aFactGlobe/disc/ActivityStatus_Producing_labels.kml'); ...

Efficiently populating a dataTable with data using ajax

Here is the code I am using to load a data table: $(".dataTable").dataTable({"bProcessing": true, "sAjaxSource": "datatable"}); This file contains the data for the datatable: return '{ "aaData": [ [ "row 1 col 1 data", "row 1 col 2 data", "row 1 ...

What is the proper way to justify text alignment in HTML?

I want to align the text to the right like the first row, but the second row keeps overflowing below the image. How can I ensure that the text is properly aligned regardless of the number of rows? <a href="javascript:;" id="A_3"><i id="I_4">&l ...

Accessing desired option from dropdown in Laravel

Can someone help me with a simple issue I'm having? I'm attempting to obtain the selected value from a dropdown list. Dropdown List: <select name="category_id" class="form-control selectpicker"> <option value="">Select C ...

What happens when a `calc()` width has an invalid value and is not ignored?

After coming across this question, I stumbled upon an intriguing observation. Given that negative widths are considered illegal and should be disregarded, one would assume that style properties such as width:-200px; and width:calc(0% - 200px); would have ...

Interactive data visualization with hover-over details

I am utilizing datamaps to showcase the countries of the world, however, I want the graph to be centered. The issue arises when I hover over a country and the pop up appears all the way to the left, aligned with where the country would be if it wasn't ...

Exploring the options available for setting types in Angular-formly

While using setType to create a new type in angular-formly, how can I show the options in the template? I am trying to create a type called "category" that will display the label on the webpage. How can I retrieve the label name? This is what my code loo ...

Stop SVG Text from Rotating using CSS

I designed an SVG circle containing text and now I would like to apply a CSS transform to rotate the SVG, but without rotating the text element. .progress { webkit-transform: rotate(-90deg); transform: rotate(-90deg); } .progress__value { stroke-d ...

Tips for choosing a block using Puppeteer

Trying to retrieve the height of a series of blocks using Puppeteer, I encountered an issue where I couldn't select my block in page.evaluate() due to an error. The code snippet in question is as follows: (async () => { const browser = aw ...

The most basic security measure for safeguarding a webpage

Currently, I am developing a website that requires customers to input a specific "code" in order to gain access. Upon visiting the site, users will be prompted to enter a simple code to proceed further. My programming skills are limited to HTML, CSS, and J ...

JQuery's method $.data() now returns a boolean value instead of a string

Can anyone help me with this html element I have? <a href="javascript:void(0)" class="sortArrow down active" data-order_asc="false"> <img src="/static/web/img/down-active.gif"> </a> The issue I am facing is that $('a.sortAr ...

Switch between divs using an update panel

Consider this scenario: Numerous div controls are present on an aspx page, and update panels are being used to prevent page refresh. These divs contain various controls like buttons and textboxes: <asp:UpdatePanel ID="UpdatePanel1" runat="server"> ...

Are there any great C# applications built on asp.net?

Seeking recommendations for quality open source ASP.NET (C#) applications that align with the following criteria: Well-designed and structured with multiple tiers Clean, well-commented codebase Incorporates various design patterns effectively Web pages ...

JavaScript code to generate diamond-shaped numbers

Greetings everyone! I am facing an issue with my code that is supposed to generate diamond-shaped numbers using javascript. The code involves two javascript functions triggered by a single onclick event, but unfortunately, one of the functions does not see ...

What causes the bootstrap grid system to deviate from the intended column sizes?

Here is the alignment I am aiming for with the Phone and Extension fields in the form: https://i.sstatic.net/JRmDU.png This is the code snippet I have written for the Phone and Extension row: <div class="row form-group"> ...

Display a pair of distinct items side by side on a webpage

When needing to display information in the format below: Reason : reason number 1 reason number 2 reason number 3 Code : code number Remarks : remark In this scenario, Reason, Code, and Remarks serve as headings enclosed in <s ...

Introduction screen in a JQuery mobile application for Android devices

I'm currently working on an Android app that utilizes jQuery Mobile within my web-based application. I have multiple pages in the app and I am considering adding a splash screen to display when loading a new page or while the page is being loaded. Any ...

Update the height definition for the alert box

I need to adjust the height of my alert box, so I attempted the following: @alert-box: 60px; .alert-msg { height: @alert-box; margin: 20px 0px; } However, the outcome was In the image provided, it is evident that the text within the secon ...

Using CSS to create sleek all-black Flaticons

After trying various solutions, I am still unable to fix this issue. I downloaded some icons and in the demo, they all appear as they should, with a more colorful aesthetic. Here is what the icons should look like: However, this is how the icons actually ...