How to make a letter stretch all the way down the paper?

As I'm creating a table of contents for my website, I was inspired by an interesting design idea that I came across:

I am particularly drawn to how the T extends down and each section is numbered with the title wrapped around it. How can I achieve this effect on my own website?

I attempted using an <hr> tag along with this CSS:

.contentLine{
        border: 1px solid white;
        background: white;
        width: 2px;
        height: 200px
    }

Although this creates a straight vertical line as desired, I'm unsure of how, or if it's even possible, to connect it to the word "Contents" that is displayed on my page. Additionally, I prefer not to use the position: absolute; property as I want my website layout to be scalable.

Answer №1

If you're looking to create the illusion of extending a part of an alphabet, one way to achieve this is by utilizing the ::before and ::after pseudo-elements in CSS.

.content{
  text-transform:uppercase;
  font-size:55px;
  font-family:verdana;
  font-weight:700;
}
.t{
  position:relative;
  font-size:35px; /*Control the overall T size*/
}
.t::before{
  content:'';
  height:100%;
  width:100%;
  position:absolute;
  left:-50%;
  top:-50%;
  background-color:black;
  transform:rotate(90deg);
}
.t::after{
  content:'';
  height:1000%;
  width:100%;
  background-color:black;
  position:absolute;
  left:-50%;
  top:0%;

}
<div class="content">
  conten&nbsp;<span class="t">&nbsp;</span>
</div>

Answer №2

Instead of utilizing the ::before and ::after pseudo-elements, I decided to create an hr element that aligns with the text and runs vertically down the page. You can view the implementation on Codepen.

html {
  font-family: verdana;
  max-width: 99%;
  height: 200%;
  display: flex;
  flex-direction: row;
}

hr {
  /*Rotates hr*/
  transform: rotate(90deg);
  /*Coloring*/
  border-color: black;
  background-color: black;
  /*Defining Position*/
  position: relative;
  left: -153.26px;
  height: 3.3px;
  top: 185px;
  width: 459px;
  /*Defining Padding/margins and overflow*/
  margin-top: 10px;
  overflow: hidden;
}

#num {
  /*Allows for adjustment of number and description spacing*/
  margin-top: 20px;
  /*Adjusting left offset*/
  z-index: -10;
  margin-left: 40px;
}

#desc {
  /*Allows for adjustment of number and description spacing*/
  margin-top: -50px;
  /*Adjusting left offset*/
  z-index: -10;
  margin-left: 40px;
}

#bd {
  display: flex;
}

#title {
  /*Adjusting bottom & left offsets*/
  margin-left: 20px;
  margin-bottom: -15px;
}

#title1 {
  /*Adjusting bottom & left offsets*/
  margin-left: 140px;
  padding-bottom: 10px;
}

#other {
  padding-top: 40px;
}
<h1>CONTENT</h1>
<hr>
<div id="bd">
  <div id="num">
    <h2>1</h2>
    <h2>2</h2>
    <h2>3</h2>
    <h2>4</h2>
    <h2>5</h2>
    <h2>6</h2>
    <h2>7</h2>
    <h2>8</h2>
  </div>
  <div id="desc">
    <h2 id="title">Book One: The Coming</h2>
    <h2 id="title1">Of The Martians</h2>
    <h2>Longer Description 1</h2>
    <h2>Description 2</h2>
    <h2>Longer Description 3</h2>
    <h2>Description 4</h2>
    <h2>Longer Description 5</h2>
    <h2>Description 6</h2>
    <h2>Longer Description 7</h2>
    <h2>Description 8</h2>
  </div>
</div>
<div id="other">
  <h1>Other Page Content</h1>
</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

Employing CSS animations to elevate div elements

Currently, I am working on animating a table of divs and trying to achieve an effect where a new div enters and "bumps up" the existing ones. In my current setup, Message i3 is overlapping Message 2 instead of bumping it up. How can I make Messages 1 and 2 ...

Tips for automatically adjusting a vertical side bar to fit between the browser's header and bottom

I'm having trouble with aligning my sidebar vertically between the header and the bottom of the browser window. Currently, the bottom items are extending beyond the browser's bottom edge. How can I adjust this to ensure proper alignment? Here is ...

What is the best way to isolate the CSS of individual components in Angular 2?

For the first component: CSS-- ngx-dnd-container { color:black; background-color: white; } HTML- <ngx-dnd-container [model]="targetItemsA" dropZone="multiple-target-a" </ngx-dnd-container> For the sec ...

Adjusting the empty image source in Vue.js that was generated dynamically

Currently experimenting with Vue.js and integrating a 3rd party API. Successfully fetched the JSON data and displayed it on my html, but encountering issues with missing images. As some images are absent from the JSON file, I've saved them locally on ...

Creating a dynamic 2D image using HTML5 animation

As a beginner HTML5 developer, I have been exploring ways to create an animated image using multiple jpg files stored in a specific folder on my website. My goal is to design an animation of a rabbit running across the page when a user clicks on a button. ...

Obtain the content from a dynamically generated dropdown menu and incorporate it into a separate file

My website features two dropdown menus - one for selecting countries and another for cities. The country menu is populated with data from a database, and once a country is selected, the city dropdown is dynamically filled with corresponding cities using a ...

What is the best way to position a box in the center using CSS?

I have constructed a container using div and included 4 additional div elements inside: HTML: <div className='main__container'> <div className='item'>Image</div> <div className='item'>N ...

What is the best way to open the index.html file in electron?

I'm currently developing a cross-platform app using electron and Angular. As of now, the code I have for loading my index.html file looks like this: exports.window = function window() { this.createWindow = (theBrowserWindow) => { // Create ...

When errors occur while printing HTML through an Ajax request, it can hinder the functionality of other JavaScript code

I recently conducted an interesting experiment on my website. The concept involved sending an AJAX request to a PHP file, which then retrieved a random website by using various random words for search queries on Google. The retrieved website content was th ...

Error with Flask url_for when trying to play a video

I'm currently developing a Flask website and working on analyzing and displaying a video on the webpage. However, when I tried to input the direct path to the video source, it only displayed a black screen. I searched on Google, which suggested using ...

The Flutter image blurs into a striking combination of red and black as the screen dimensions are altered

https://i.stack.imgur.com/YeZa6.png Hello everyone, we are facing an issue with Flutter web. Here's what's happening: When we use flutter run -d chrome --web-renderer canvaskit and flutter run -d chrome --web-renderer html, nothing changes. If ...

The document type specified in the HTML validation process does not support the use of the "hr" element

My goal is to display a list of articles including images, titles, horizontal lines, and dates using a UL. Unfortunately, I encountered a validation error when testing them on the website validator tool at https://validator.w3.org/. Below is a simplified ...

Issue with JQuery's click and submit events not triggering, but change event is working fine

My webpage has a dynamic DOM that includes add and save buttons to interact with elements. Each row also has a remove option for deletion. When a user logs in, the controller redirects them to their homepage in the codeigniter PHP framework. This controlle ...

The caption below the image is not functioning correctly when hovering over it

I'm having trouble getting the text to appear correctly underneath the image. Whenever I hover over the image, the text seems to overlap it. I am sure there is a simple solution to this issue, but I can't seem to figure it out. Removing the inlin ...

Prevent jQuery UI default styling from being applied

I'm curious about how to prevent jQuery UI from adding any classes when initializing $.tabs(). This is the structure of my HTML: <link href="smoothness/jquery-ui-1.8.20.custom.css" rel="stylesheet" type="text/css" /> ... <link href="estilos ...

What is the process for marking a form field as invalid?

Is it possible to validate the length of a field after removing its mask using text-mask from here? The problem is that the property "minLength" doesn't work with the mask. How can I mark this form field as invalid if it fails my custom validation met ...

javascript: window.open()

I am currently using VB.NET 2005 and I have a requirement to launch a new browser window using Process.Start(). The challenge is that I need to specify the size of the browser window, for example, height:300 and width:500. Process.Start("firefox.exe", "ab ...

Aligning the navigation links vertically

I am working on aligning my navigation bar vertically, even when I scroll the page. I found a method in another thread which suggests using the following CSS code for vertical alignment: #container { position: absolute; top: 50%; height: 400p ...

Preventing selection of past dates with Material UI in ReactJS

I'm currently working on a date range picker using react material ui. The goal is to allow users to select a specific date and then disable all past dates from that selected date onward. How can I go about implementing this functionality in react mate ...

Employing jQuery for adding a class to the initial TD in every table row

Currently, I am dealing with a table structured like this: <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tablecontent"> <tr class="tablerow"> <td>This is the td I want to add a class to.</td> <td c ...