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

Tips on dividing a CSS file into separate lines for improved readability

I came across a dilemma while working with a 3rd party CSS file that is all one long line. Both the Sublime 2 text editor and Eclipse CSS editor were unable to split the file into easily readable style blocks. Can anyone recommend tools or methods for bre ...

Adjust the color of the glyphicon icon within a date and time picker dropdown component

I decided to implement the bootstrap datetimepicker using this gem and utilized the following HTML code: <div id="custom-dates" style=" clear:both;"> <div class="container"> <div class="row"> <div class='col-md-3 col-xs-3' ...

What criteria do browsers follow to determine the specific colors to use for border styles like inset and outset?

When I set border: 1px outset blue; as the style for an element, the browser displays two distinct border colors: one for the top and left borders, and another for the bottom and right borders. li { border: 10px outset #0000FF; color: #FFF; ...

What is the strategy used by jQuery to select elements by class name?

Is there a "getElementsByClass" function in JavaScript? If not, how does jQuery manage to do it without looping through all elements which would be very inefficient? Also, how can I specify CSS for elements with two or more classes? <a class="one two ...

Creating code to ensure a div element is displayed only after a specific duration has elapsed

Can anyone help me with coding to make a div appear on a website after a specific amount of time? Here's an example of what I'm trying to achieve: <div class="container"> <div class="secretpopout"> This is the hidden div that should ...

The height property in the CSS is causing the parent element to break and cannot be confined

Here is the HTML code that I am currently working with: <div id="div1"> <p id = "a"> <! -- content --> </p> <p id='b'> <! -- content --> </p> </div> Additionally, th ...

when the window is scrolled a certain amount, use jQuery to scroll back in the opposite direction

Using jQuery for Background Image Position: $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 50) { $(".class").addClass("bgposi"); // $(".top").addClass("fixd"); // $(".logo").addClass ...

The Google Maps App fails to launch now

Recently, my map started experiencing issues. The problem seems to be related to the HTML using a javascript and css file that is loaded from Google Drive for display. However, when I directly load these files from my computer, it works perfectly fine. Bel ...

Using jQuery to create a dynamically moving div that forms an endless wall

In order to create a continuous wall that pulls text from a database and displays it, I've developed the following code: $(function() { var x = 0; var y = 100.0; var z=0; setInterval(function() { x -= 0.1; y -= 0.1; ...

The submission of the HTML form is resulting in a lack of values being returned by

I am new to HTML and PHP programming. I have been struggling with an issue where the data submitted from a form is not being fetched by $POST, resulting in empty values being sent via email. I have spent a considerable amount of time trying to solve this p ...

Overriding Styles Set by an External CSS file

Let's assume that I have two different style sheets set up on my webpage: site.css: .modal { position: absolute; width: 200px; ... } ... reset.css: .reset * { position: static; width: auto; ... } Unfortunately, I don ...

Tips on aligning vertically centered left and right floating objects without having to use the line height property

          Here is the issue I am facing http://jsfiddle.net/vT4YT/ <table><tr><td><div></div><div></div></td></tr></table> You can see that the options and row text are not vertic ...

HTML forms default values preset

I need help with pre-setting the values of a dropdown menu and text box in an HTML form for my iPhone app. When the user taps a button, it opens a webview and I want to preset the dropdown menu and text field. Can someone guide me on how to achieve this? ...

JavaScript personalized video controls. Silence the video by manipulating the input range element

As a newcomer to javascript, I am working on creating custom video controls using js. One issue I am facing is with a span element that contains a mute/unmute icon. When I hover over this span element, a child element appears with an input range bar for ad ...

Excessive width of the lower border

I have a dropdown menu on my website and I wanted to add a border-bottom to the menu. However, the border appears too wide. I went through every step of this solution as it seemed like the same problem, but nothing seems to be working. It would be great i ...

How can I attach a click event to the left border of a div using jQuery?

I am wondering about a div element <div id="preview"> </div> Can anyone suggest a method to attach a click event specifically to the left border of this div? Your help is greatly appreciated. ...

apply a border-radius to the top right corner only without affecting the other sides or background

I have been working on creating the top right triangle design shown in the image. However, I encountered an issue where applying border radius seems to affect all sides instead of just one as intended. Despite using border-top-right-radius: 5px;, I am not ...

Dynamic row height in MUI DataGrid

I'm currently utilizing the MUI DataGrid component, and I have a specific behavior in mind that I'd like to achieve: When there is a small number of rows present, I want the table to only occupy the necessary space for those rows. On the other h ...

How can I create a timed slideshow of images?

Is there a way to make a series of images slide automatically after closing or stopping a video? To see the specific website in question, click here: Upon visiting the site, a video pops up. How can I program the image slides to transition every 7 secon ...

The CSS :not selector does not work as intended

My goal is to assign the class no-color to a specific tag. When JavaScript is enabled, I want this class to be removed and the text to be colorized. However, my current CSS solution is not working as expected. Below is a sample code snippet demonstrating t ...