Adjusting dimensions using CSS

I am facing an issue where my tab names are displaying too large and I would like them to be default size. I have placed the following script in the <head>.

<style type="text/css">
                { font-family: Verdana; font-size:40%; }
                label { width: 15em; float: left; }
                label.error {display: none; float: none; color: red; padding-left: .5em; vertical-align: top; }
                p { clear: both; }
                .submit { margin-left: 12em; }
                 em { font-weight: bold; padding-right: 1em; vertical-align: top; }

        </style>



        <style type="text/css">
                body 
                {
                        font-family:Times new roman, verdana;
                        font-size:22px;
                        width: 850px;
                        margin-left: auto;
                        margin-right: auto;
                        margin-top: 6px;
                        background-image:url("wood_texture2.jpg");
                }
        </style>

This setup applies the same size settings for everything inside the <body>, but I want different sizes for each item within the body. What is causing this issue and how can I adjust sizes individually?

Answer №1

Your css file has a syntax error at the beginning

{ font-family: Verdana; font-size:40%; }

A possible correction could be

body { font-family: Verdana; font-size:40%; }

Answer №2

Avoid using the width attribute in the body style declaration as it serves no purpose. Instead, assign specific width/height values to each element that requires a unique size:

div {
    width: 30px;
    height: 50px;
    background-color: #F00;
}

Just like you did with .sumbit in your code, utilize classes for html elements that need different styles.

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

The JScolor Color Picker has a slight misalignment

I am having an issue with the jscolor color picker on my webpage. The rainbow part of it appears offset within the rest of the picker. You can see what it looks like on my site here: (https://ibb.co/9N8dHXs). On my website, I have a large canvas for three ...

CSS fluid divs floating on a single line

Imagine having a series of images with text below them, all wrapped in a div and centered. There are 20 of these elements with similar image sizes but varying amounts of text. The goal is to line up as many as possible on one row, each with 10px margin on ...

Exploring CSS shaders in a browser?

Which browser out there fully supports CSS shaders? ...

I'm curious as to why the id property does not override the selector in the $(selector).html function within this code

As a newcomer to the programming world, I find myself facing challenges that are not as straightforward as they seem. My goal is to display various data sources in different divs, but the solutions I have come across so far have been too advanced for my cu ...

The dropdown login form is malfunctioning on my Wordpress website

After reading various tutorials and guides online, I managed to set up a login screen. You can view the code in my jsfiddle: Jsfiddle. Unfortunately, I am facing issues with making the code function correctly. Being new to Jquery, I might have made a begin ...

Having trouble getting the jQuery AJAX post syntax to work properly

I am trying to send a post json value to another page using AJAX. However, when I include the "json" parameter in my POST request, the JavaScript code stops working. If I remove the "json" parameter, it works fine. I am still learning jQuery so any help ...

Tips for customizing the background of form inputs in React-Bootstrap

Currently, I have a next.js project with react-bootstrap. I am attempting to change the default blueish gray background color (#e8f0fe or rgb(232, 240, 254)) that bootstrap uses for form inputs to white. To achieve this, I am customizing the bootstrap var ...

Vibrant Reverberation of Color

When creating a table connected to a MySQL database, I encountered an issue with changing the text color inside the rows. How can I display the text in white within the table? I attempted to use <style = color #34242, but it didn't produce the des ...

Is it possible to use a jQuery plugin on a hidden div?

Dealing with some jquery tabs here. I've incorporated a plugin for a scrolling pane of options within the tabs, but it seems to malfunction when clicking on a tab that was hidden on initial page load. Even tried initiating the plugin using the :hidden ...

Tips for capturing changes in a "count" variable and executing actions based on its value

I have a counter on my webpage and I'm trying to change the style of an element based on the count variable. I tried using the .change action but I haven't been able to get it working. It might not be the right solution. Can anyone provide some ...

Is the textarea's shape out of the ordinary?

Most textareas are typically rectangular or square in shape, similar to this: However, I am interested in having a custom-shaped textarea, like the example below: Is it feasible to achieve? ...

Displaying JSON data received from an AJAX request on the screen

Our server is located in Europe. Occasionally, a user based in America reports an issue when using the $.getJSON function. Instead of passing the JSON response to JavaScript, the user's browser simply displays it. The AJAX call appears as follows: ...

Creating a grid layout similar to Tumblr using HTML and CSS

Struggling all day to figure out how to create a Tumblr-style grid for my website, I'm reaching out here for some assistance. Here is the page: I have a grid of images on my project page that initially looked fine, but as I try to add new elements, i ...

Troubleshooting problems with the width of a UI Bootstrap accordion container

Check out this Plunker for help! Having some trouble with ng-Grid inside a ui.bootstrap accordion. Visit my Plunker to see the issue firsthand. Essentially, when I place a grid inside an accordion with the child accordion-group closed upon page load, the ...

Selected selector failing to function properly

I have been diving into the world of jQuery selectors and wanted to share a small example I created. The idea is to display what has been selected from a dropdown menu, but unfortunately, my example isn't functioning properly. I must be making a small ...

The dropdown menu stubbornly refuses to close even after multiple clicks on it in the mobile responsive user interface

Currently, I am tackling the challenge of creating a website navigation bar with a dropdown menu that adjusts to different screen sizes. However, I have encountered an obstacle where the dropdown menu fails to close when I click outside of it. To address t ...

The connection between a database and jQuery AJAX using PHP is not established

Check out this snippet of HTML code: <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="submit" id=& ...

The peculiar formatting issue with the jQuery datepicker that arises when adding more months

When adjusting the numberOfMonths parameter to a higher value such as 6, I noticed that the datepicker display appears unusual with the background extending further than expected. Take a look at my demonstration on jsfiddle: http://jsfiddle.net/zw3z2vjh/ ...

How can CSS be leveraged to generate a fluid and adaptable grid layout for icons?

Please note that using a script is not an option for me My goal is to include a set of 12 100X100 icons at the bottom of emails sent to customers. These icons should be displayed with 100% width and evenly spaced, like this: X X X X X X X X X X X X If t ...

Ensuring that the most recent accordion added remains open and dynamic

I am attempting to dynamically add Bootstrap accordions by clicking on the ADD button. Each time the button is clicked, I want a new accordion to be generated while closing any previous ones. I am having trouble understanding how to use Bootstrap methods a ...