Tips for modifying the font style of a Bootstrap form input using a custom font

While developing my website using Bootstrap 4, I encountered an issue with the custom font (GeosansLight) I applied to the entire website through the body's CSS attribute. The problem arose when the default Bootstrap form inputs appeared too light to be noticeable with the custom font.

Specifically, on one page, I attempted to use a Bootstrap form template with placeholders for each field. However, the input format was too light to be legible. I experimented with changing the font back to the default setting and even tried making the letters bold using the font-style: bold attribute, but only the form labels were affected.

HTML:

<form>
    <div class="row mt-2">
      <label for="inputName" class="col-sm-2 col-form-label">Full Name</label>
      <div class="col-sm-4">
        <input type="text" class="form-control" id="inputName" placeholder="Enter your full name">
      </div>
  </div>
</form>

CSS:

<style type="text/css">


input {
  font-weight: bold;
  font-size: 17px;
}

label {
  text-align: center;
}

form {
  font-weight: bold;
  font-size: 15px;

}

body {
font-family: GeosansLight;

}

@font-face { font-family: GeosansLight; src: url('GeosansLight.ttf');  }

form input {
  font-weight: bold;
  font-size: 20px;
}
</style>

I had expected a standard Bootstrap form input field that was dark enough for readability, but the outcome was a very light, almost faded appearance with a placeholder. Even when typing in the placeholder, the resulting text remained light.

What changes should I make to darken the form input so that it is not affected by the custom font?

Answer №1

Experiment with different font styles such as Light, bold, and normal, and try using fonts with varying font-weight for an interesting look. For more tips and tricks, check out this resource

@font-face {
   font-family: 'Ubuntu';
      src: url('Ubuntu-RI-webfont.eot');
      src: url('Ubuntu-RI-webfont.eot?#iefix') format('embedded-opentype'),
           url('Ubuntu-RI-webfont.woff') format('woff'),
           url('Ubuntu-RI-webfont.ttf') format('truetype'),
           url('Ubuntu-RI-webfont.svg#UbuntuItalic') format('svg');
   font-weight: 400;
   font-style: italic;
}

@font-face {
   font-family: 'Ubuntu';
      src: url('Ubuntu-B-webfont.eot');
      src: url('Ubuntu-B-webfont.eot?#iefix') format('embedded-opentype'),
           url('Ubuntu-B-webfont.woff') format('woff'),
           url('Ubuntu-B-webfont.ttf') format('truetype'),
           url('Ubuntu-B-webfont.svg#UbuntuBold') format('svg');
   font-weight: 700;
   font-style: normal;
}

Here is an example of how you can implement it in your html

.u400 {
   font-family: 'Ubuntu', arial, sans-serif;
   font-weight: 400;
   font-style: normal;
}

.u400i {
   font-family: 'Ubuntu', arial, sans-serif;
   font-weight: 400;
   font-style: italic;
}

.u700 {
   font-family: 'Ubuntu', arial, sans-serif;
   font-weight: 700;
   font-style: normal;
}

.u700i {
   font-family: 'Ubuntu', arial, sans-serif;
   font-weight: 700;
   font-style: italic;
}

Answer №2

To resolve the problem, consider using the Geosans font in a different weight such as normal or bold instead of GeosansLight.

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

What is the best way to adjust the size of my <div> to accommodate additional vertical content?

Every time I attempt to include margin-top: 30px to my box_1 and box_2 <div>, the bottom <div> is pushed down and disappears. It seems like my wrapper isn't expanding to accommodate the content. How can I achieve a 30px space between the ...

Div that scrolls independently without affecting the position of other elements

Visit this link for reference <div class="col-10 content" id="content"> <ul> <li>News</li> <li>News</li> <li>News</li> <li>News</li> < ...

What key element is not included in this code?

I've been trying to create an interactive green circle that switches between red and green when clicked. Despite checking and rechecking my code, it's still not functioning correctly. I must be making a beginner mistake somewhere. Can anyone poin ...

Having difficulty positioning two elements within a button using bootstrap

I am attempting to align two texts horizontally inside a button using Bootstrap 4. The word "Link" keeps getting pushed to the next line and I would like it to stay beside "Copy". I have experimented with using Float but it ends up moving "Link" too far t ...

How can I remove the bouncing effect of the top bar in Chrome when scrolling in Three

There is a frustrating problem I am encountering on my website with the joystick control. Whenever I try to move my joystick down, Chrome triggers either the refresh dropdown or the top bar bounces and goes in and out of fullscreen mode. ...

Cannot utilize the "classname" table while working with Bootstrap or React Bootstrap in ReactJs

I am trying to integrate the react-bootstrap theme into my ReactJs-Spring project. Following the tutorial on the website, I have added the necessary resources: <script src="https://unpkg.com/react@latest/dist/react.js"></script> <script sr ...

Property float does not account for margin values

Currently delving into the world of the semantic-ui framework, I have been working with segments. Here is a snippet of my code: <!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery ...

Struggling to figure out the method for obtaining css selectors for scraping in scrapy

Struggling with scraping a website and figuring out how css selectors work in Scrapy. The css in question: https://ibb.co/eJeZpb Here are some standard css selectors: .css-truncate-target .message .js-navigation-open time-ago For scrapy, you would need ...

Flipping a 2-dimensional box using CSS and incorporating cascading flex divs

*Please read the note: This question is a bit lengthy as I wanted to explain my thought process. For those who prefer not to read everything, I have created codepens for easy reference. Essentially, I am looking to achieve CSS box flipping effects like t ...

How can recursive data be displayed in a template?

I am working with a model in Django that has a ForeignKey pointing to itself, and I need to display all the data from the database using lists and sublists: Below is my model definition: class Place(models.Model) name = models.CharField(max_length=1 ...

Interactive ajax and php dropdown menu

Hey there, I'm running into a small snag with my dynamic select feature, as mentioned in the title. I am aiming to achieve the following outcome: When a user selects an instrument from the first dropdown menu, the second dropdown menu labeled "Besetzu ...

Styling DL and DD elements with Zend Framework decorators

When incorporating a Subform named "Step1," your code will look like this: <dl class="zend_form"> <dt id="Step1-label"></dt> <dd id="Step1-element"> <fieldset id="fieldset-Step1" class="Step"> < ...

Ensure that divs can adjust in size while maintaining the same dimensions of their contained

I'm currently facing a slight issue with these two divs. I want them to be scalable, which I know can be achieved by using percentages, but every time I do so, the divs end up out of position. When I try setting widths, they look fine in Google Chrome ...

Manipulating the 'display' attribute with jQuery

Is there a way to show an element that has been hidden using the following CSS? .pds-pd-link { display: none !important; } Can jQuery be used to enable the display of the .pds-pd-link CSS? For example, would $(.pds-pd-link).css("display",""); ...

Position filter forms on the left side to align with bootstrap cards

I'm having trouble aligning the cards using Bootstrap's row and col- classes. The first three are behaving as expected, but the fourth one isn't cooperating. Any idea why this might be happening and any solutions you can suggest? View the i ...

Adding multiple lines of text using jQuery

I am facing an issue while trying to append a string to an HTML element. It works perfectly fine with a single line string, but breaks when I try to split it into multiple lines. <div><h4 >List to do:</h4><span id="added"></span ...

Animating a Canvas to Follow Mouse Coordinates

I am looking for a way to animate a circle moving towards specific coordinates, similar to the game . I have attempted using the jquery animate() function, but it is too slow due to the constant updating of the target coordinates. Is there a faster metho ...

Designing an HTML banner with 100% width and 660 pixels in height for optimal responsiveness

I am in need of a responsive banner that will be displayed at 100% width and 600px height on fullscreen. Below is the code I have: <style> /* default height */ #ad { height: 660px; width: 100%; } @media o ...

I'm having trouble finding a solution to remove the white space

I've been troubleshooting a website and noticed some unexpected whitespace on the page. Even though I have set my page wrapper div and other elements to width: 100%, the content in between is not utilizing the full width of the screen. I suspect this ...

Adjustable table region in PHP

I need help with displaying multiple results in a dynamically created table within my program. Even though I want to show around 25 records, the program cuts off after the 5th record, leaving empty space. The issue seems to be that the area does not expand ...