Reduce the size of all elements on the website in Semantic UI

I am facing an issue with my semantic UI website where everything appears too zoomed in and I would like to scale it down proportionally, from fonts to containers and segments.

Attempting to solve this problem, I have tried using CSS properties like zoom: 80%;, which worked well in Google Chrome but not in Firefox.

Then, I experimented with using transform scale:

html {
    -webkit-transform: scale(0.8);
    -ms-transform: scale(0.8); 
    transform: scale(0.8);
}

However, a drawback of this method is that the header and footer lost their intended 100% width.

Is there a specific way in Semantic UI to achieve this scaling effect? I have used site.variables to modify color variables but I am unsure if I can adjust default sizes for elements uniformly by reducing px or em size across the board.

Do you know of any CSS or Semantic UI technique to accomplish this task?

UPDATE:
For instance, on my site, when viewed at certain resolutions, segments are set to a width of 1135px. I would prefer these widths to only apply at resolutions above 1300 or 1400px, or alternatively have segment widths at 1000px for 1200px resolution. Ideally, I would like to standardize this behavior for all components rather than having to write custom CSS for each element to override default settings.

This is the current styling applied to each container:

@media only screen and (min-width: 1200px)
.ui.container {
    width: 1135px;
    margin-left: auto !important;
    margin-right: auto !important;
}

Is there a more efficient approach to handle this situation without needing to individually adjust width specifications for every element? When viewing the site on screens slightly larger than 1200px, I find the overall size to be excessive.

Answer №1

In order to customize the appearance of your components in Semantic UI, Gulp is used to compile the CSS and Javascript for your project. It's essential to adjust the base font-size to make components smaller, but it must be done before compilation takes place. Changing this value after the fact may lead to unexpected outcomes, as the sizes for various components have already been calculated.

To modify the base size, navigate to {theme}/globals/site.variables:

/*-------------------
      Base Sizes
--------------------*/

/* Control all sizes with this single variable */
@emSize   : 14px;

/* Adjust page text size */
@fontSize : 14px;

After making these changes, run gulp build to compile everything. If you prefer not to use the default build tools provided by Semantic UI, you can create your own custom gulp functions. Additional information on theming can be found here.

It's important to avoid scaling the entire document up or down, as this is not considered a best practice. Some browsers do not support the transform property, which could result in text and borders appearing blurry.

Answer №2

From what I understand, Semantic UI opts for relative sizes when it comes to styling elements. To adjust the font-size accordingly, you can try this simple solution:

html, body {
    font-size: 14px;
}

Typically, the default size hovers around 16px.

Answer №3

After much exploration, I have discovered a solution to this problem and feel compelled to share it with the community in case others encounter the same issue.

Instead of simply overriding CSS rules, which can be difficult to maintain, I opted for a more standardized approach using Semantic UI.

My resolution involved modifying

src/site/elements/container.variables
to adjust the default width for large monitors from 1200px to 1000px:

@largeMonitorBreakpoint:1000px;

By making this alteration, I ensured that the breakpoint for large monitors is now set at 1000px, influencing the container widths accordingly so that each container will now occupy up to 935px.

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 design an HTML table that collapses all the columns in the header while showing the columns in the body?

I am looking to design an HTML table with a single header and 4 cells in each row. Can you guide me on how to achieve this? Specifically, I want the header to span the full width (100%) while the cells should have widths of 40%, 10%, 40%, and 10% respectiv ...

Trouble Encountered with AngularJS ng-bind-html and Text not Wr

I am facing an issue with a table cell containing very lengthy text. While the text displays properly in edit mode, it overflows and does not adhere to the width of the cell when not in edit mode. I even tried removing it from ng-bind-html, but the problem ...

Display of menu content may be unavailable at certain screen resolutions

Upon creating a new project in Visual Studio 2017, I developed a default master and sub pages website. In the master page, I incorporated a menu using a mix of divs and tables. Everything functions properly except for when the window size is reduced to a ...

Ways to prevent decreasing the value below zero in ReactJS?

I have created two buttons, one for increasing and another for decreasing a counter value. However, when I click on the minus button, it should not display negative values. But in my case, when I click on the minus button (initially at zero), it shows -1, ...

Successfully executing complex designs using CSS grid or flexbox

I have a specific responsive layout that I need to achieve using a series of div tags. Below is the HTML structure I have: <div class="container"> <div>1</id> <div>2</id> <div>3</id> <div>4& ...

"Customize your search experience with a bootstrap search bar featuring multiple input fields

Currently working on a website using Bootstrap and trying to create a filter bar for the items displayed on the page. I am looking to include one or more input fields (highlighted in red) and one or more dropdowns (highlighted in blue). The width of the ba ...

What is the best way to set a minimum width for websites with relative (%) widths that are compatible with IE6 and above?

I am working on a website where I utilize percentages (%) for widths to create a flexible layout. However, I am encountering an issue where everything breaks at a certain width, such as 800px. Is there a way to set a maximum width of 800px and then displa ...

Issues with HTML Email display

Hey there, I am facing an issue while trying to send an HTML email. I am aware that Outlook does not support a lot of CSS formatting, but I can't figure out why this simple setup is breaking. Is there a quick fix or alternative solution? Take a look a ...

Missing ghost image appears when you drag and drop the file

New to JavaScript... As a rookie in coding, I often get interesting requests from my partner who is a kindergarten teacher. Recently, she asked me to create a "Function Machine" for her classroom activities. With some trial and error, I managed to put tog ...

Comparing the use of jQuery's data() method versus directly accessing attributes with native JavaScript using get

I want to retrieve general information from my website using javascript. I have a few different options available: I could use an html element: <input type="hidden" value="MyValue"/> Another option is to use a custom attribute in an existing h ...

Problems with Wordpress AJAX search functionality

I am currently working on implementing a search feature using AJAX to dynamically load posts. However, I am facing an issue where the results are not being displayed. This code snippet was adapted from another source and modified based on private feedback ...

Creating a bespoke Bootstrap 4 Modal experience without the backdrop

I'm attempting to show a Bootstrap 4 modal without a backdrop. I've tried the following code with no success: .modal.right. modal-backdrop.show { background-color: transparent !important; } When I try this modification, it works (but affect ...

Finding elements using XPath in Selenium

When using Firebug to inspect an input field I need to fill in, I found this code: <label for="form:composite:tabView:ssn">Fødselsnummer</label> In my selenium script, I tried the following: WebElement element = driver.findElement(By.xpath ...

Center the div vertically

How can I vertically center a div next to a tall image using CSS? The left column (#watch) is an image and the right column (#watch-column) is a div that needs to be centered. I've tried different methods but nothing seems to work with my somewhat flu ...

Developing a robust system for managing classnames

I have a question regarding the article I found on Quora about Facebook's CSS class names structure. They mentioned that both Facebook and Google use a build system to convert developer-friendly class names into shorter ones to save bandwidth and crea ...

Creating a custom form validation within a modal window featuring tab navigation, all styled with the latest Bootstrap

Within a modal, I have incorporated a header with tabs and tab content in the body, following the structure of Bootstrap 5. The modal footer includes buttons separated by dots. When encapsulating the modal body and footer within a form tag for validation ...

Automatically populating grids with Php

Here is a piece of HTML code I have: <div class="media row-fluid"> <div class="span3"> <div class="widget"> <div class="well"> ...

How jQuery stops the submission of a form

Sample HTML Code <p><select name="status" class="form-control" id="showThisItem"> <option value=""> Select Status </option> <option value="Paid"> Paid </option> <option value="Unpa ...

Clicking on a select box causes the scrollbar area to vanish, shifting all the page content to the right

I have successfully implemented overflow-y: scroll; to keep the scrollbar space always reserved and prevent content from shifting when the scrollbar appears. However, I noticed that when I click on a select element, this scrollbar space is lost. How can I ...

Creating a CSS layout where a square remains confined within another square even as the screen size changes can be achieved by implementing specific styling techniques and

I have a group of squares that I want to resize proportionally when the screen size changes, but they keep overlapping instead HTML <div id="Container"> <div id="smallSquare1">square 1</div> <div id="smallSqu ...