retrieving words in bold without the ability to copy

Hey there, I'm new to this!

I created a top bar with an active button that has the text "Základ" (basic) in it. I wanted to make it uncopyable for a better look, so I did, but now I can't make it bold! Setting font-weight: bold; is not working either. I am using an external CSS file. I don't want to give up on my dream of having a bold title that can't be copied, so I need your help. Any input would be greatly appreciated!

html,
body {
    margin: 0px;
    padding: 0px
}

body {
    font-family: "Lato", sans-serif;
    transition: background-color .5s;
}

.sidenav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
}

.sidenav a {
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;
    display: block;
    transition: 0.2s;
}

.sidenav a:hover {
    color: #f1f1f1;
}

.sidenav .closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
}

#main {
    transition: margin-left .5s;
    text-align: center;
    padding-left: 16px;
    font-size: 20px;
}

#posunTlacitka {
    transition: margin-left .4s;
    text-align: center;
}

#posunListy {
    transition: margin-left .5s;
}

@media screen and (max-height: 450px) {
    .sidenav {
        padding-top: 15px;
    }

    .sidenav a {
        font-size: 18px;
        
    }
}


/*HORNÍ LIŠTA*/
.topnav {
    overflow: hidden;
    background-color: #333;
}


.topnav a {
    float: left;
    color: rgb(243, 243, 243);
    text-align: center;
    padding: 0px 35px;
    text-decoration: none;
    font-size: 17px;
}

.topnav div {
    float: left;
    color: rgb(243, 243, 243);
    text-align: center;
    padding: 12px 30px;
    text-decoration: none;
    font-size: 17px;
}

.topnav a.active {
    background-color: #62d1ff;
    color: black;
}

/*LIŠTA NELZE KOPÍROVAT!*/
#noCopy::before {
    content: 'Základ';
    display: block;
}
    <div id="posunListy">
        <div class="topnav">
            <div id="posunTlacitka"><span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776; </span></div>
            <a class="active">
                <h2 id="noCopy"></h2>
            </a>
        </div>
    </div>

Answer №1

According to a previous comment, it seems that the text in your snippet is already bold. This can be observed when you use the code below:

#noCopy::before {
    content: 'Základ';
    display: block;
    font-weight: normal;
}

By implementing the above code, you should see the text appearing bold. If you're unable to notice any difference in your development environment, it might be due to a browser caching issue. Nevertheless, it appears that the text is already displayed as bold as Lato allows...

Edit: this method will 'enhance' the effect, although it's somewhat of a workaround

In essence, including -webkit-text-stroke: 1px black; in your #noCopy::before will apply an outline stroke to the text, creating the illusion of a thicker weight.

html,
body {
    margin: 0px;
    padding: 0px
}

body {
    font-family: "Lato", sans-serif;
    transition: background-color .5s;
}

.sidenav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
}

.sidenav a {
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;
    display: block;
    transition: 0.2s;
}

.sidenav a:hover {
    color: #f1f1f1;
}

.sidenav .closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
}

#main {
    transition: margin-left .5s;
    text-align: center;
    padding-left: 16px;
    font-size: 20px;
}

#posunTlacitka {
    transition: margin-left .4s;
    text-align: center;
}

#posunListy {
    transition: margin-left .5s;
}

@media screen and (max-height: 450px) {
    .sidenav {
        padding-top: 15px;
    }

    .sidenav a {
        font-size: 18px;

    }
}


/*HEADER BAR*/
.topnav {
    overflow: hidden;
    background-color: #333;
}


.topnav a {
    float: left;
    color: rgb(243, 243, 243);
    text-align: center;
    padding: 0px 35px;
    text-decoration: none;
    font-size: 17px;
}

.topnav div {
    float: left;
    color: rgb(243, 243, 243);
    text-align: center;
    padding: 12px 30px;
    text-decoration: none;
    font-size: 17px;
}

.topnav a.active {
    background-color: #62d1ff;
    color: black;
}

/*COPY PROTECTION LABEL*/
#noCopy::before {
    content: 'Základ';
    display: block;
    -webkit-text-stroke: 1px black;
}
<div id="posunListy">
    <div class="topnav">
        <div id="posunTlacitka"><span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776; </span></div>
        <a class="active">
            <h2 id="noCopy"></h2>
        </a>
    </div>
</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

Creating an HTML dynamic table with fixed height to prevent expanding when adding text

I have a dynamic table with fixed width and height. By using a random function, I determine the number of cells (ranging from 3x3 to 7x7) in the table. The table renders correctly, but when clicking on a cell to write a letter, the row expands in height. H ...

Error Alert: The attempt to load the image 'data:image/svg+xml,%3csvg > xmlns='http://www.w3.org/2000/svg' was unsuccessful after selecting a Bootstrap 5 radio button

Whenever I click on the radio button below, a message appears in the console of my various web browsers (Firefox, Chrome, etc). [Report Only] It is refusing to load the image 'data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' vi ...

Troubleshooting Issue with Bootstrap Button Group Failing to Properly De-Select Dynamically Appended Buttons

My experience with a Bootstrap 5 button group is that the code appears as shown below: <div class="btn-group d-flex justify-content-between m-4"> <input id="a" type="radio" class="btn-check" name="btn ...

Mysterious sayings encircling the words fetched through ajax

If the localhost is pointing to the folder named www, where the structure looks like: www/ file/test.cpp index.html I want to dynamically load the content of test.cpp into index.html and display it with the help of highlight.js. Below is the cod ...

The scrollspy feature in Bootstrap 5 fails to highlight the correct sections

Despite following the steps, my scrollspy is not highlighting. What could be the issue? I have replicated the HTML and CSS codes directly from getbootstrap.com. <!DOCTYPE html> <html lang="en"> <head> <meta charset="u ...

Exploring all the options within a dropdown menu using JQuery

Within the MVC 4 view, there is a dropdown box that, when its value changes, needs to capture all selected values. Each selection consists of three items: the Id, the visible value on the form, and a path to a file. While the functionality works for readin ...

Angular automatically scrolls to the top of the page when clicking on any part of the bottom

I am encountering an issue on a page where I have implemented NgFor. Whenever I click anywhere at the bottom of the page, it automatically jumps to the top. Additionally, when I try to click on a button at the bottom, the button's action does not exec ...

Eliminate any unnecessary gaps that may exist between the cards within the deck

Utilizing Jinja2 with Flask to render a list on an HTML page, I aim to produce card decks containing data from the list using a Jinja2 loop. This is my current HTML code: <div class="container-fluid"> <div class="row"> <div clas ...

Increase the value by one of the number enclosed in the <h3> element

I have a variable number of <h3> tags with the same class .love_nummer <h3 class="love_nummer">1</h3> Each of these tags contains a number, and alongside each .love_nummer tag is another tag with the class .give_love <h3 class="give ...

Jquery adds a fun, wobbly effect to animations

I'm experiencing an issue with the animation I've implemented causing some slight shaking and wobbling of the text and certain elements which is affecting the overall look. You can view a live example of this behavior here: This problem specific ...

jQuery.get() function is limited to specific types of webpages

I have successfully combined multiple weather APIs on my website, which can be found here. Recently, I started using the weather.gov API and it has been quite effective. However, there are certain data points that I need to extract which the weather.gov A ...

Setting the selected value of a COREUI multiselect widget

I received the following JSON response from an API. {"first_name":"Person 1","last_name":"Person 1","email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="78081d0a0b17163 ...

Error message encountered: "Attempted to serve a new HTML file but received the 'Cannot set headers after they are sent to the client' error."

I'm a beginner in NodeJS and I'm currently working on enhancing a sample project that utilizes the Spotify API and Express. In this project, users are required to authenticate on the homepage, after which they should be directed to a different HT ...

What is the best way to split an image in half without displaying it and avoiding any horizontal scrolling on the page?

https://i.sstatic.net/Kj99o.png https://i.sstatic.net/W1BQ8.png Trying to align the two images shown above, but facing issues with making it responsive. The SVG image exceeds the container boundaries, causing horizontal scrolling. The goal is to have the ...

Struggling to center a fixed width div horizontally in Internet Explorer

Currently in the process of creating a website template. To see an example, visit Framework Login Page The primary CSS file can be found here: master.css The centralizing of the main parent div is proving to be a challenge. This is the code I am using ...

The layout generated by Metronic does not display the CSS styles

I've been working on creating a Metronic layout using the layout builder, but I'm running into an issue. Whenever I try to open index.html, all I see is this: screenshot It appears that the CSS styles are not loading properly. Interestingly, wh ...

Is there a way to customize the color of a React component from a different source?

I am currently utilizing a React component library called vertical-timeline-component-react. <Fragment> <Timeline> <Content> <ContentYear startMonth="12" monthType="t ...

Premature audio cutoffs in Javascript/CSS when using onmousedown event

One issue I'm facing is that a small beep sound should play when clicking on a link, but it gets cut off unless the click is held down. <script> var beep = new Audio(); beep.src = "audio/select.mp3"; </script> <div cla ...

The custom font in my Next.js project is functioning perfectly in the development environment, but when I try to build it locally, the font doesn

Incorporating the Amazon Ember font as a custom font in my application has been a bit of a challenge. I followed the necessary steps of setting up a font.ts file in the lib folder and exporting the font correctly, as guided by various blog posts. Initially ...

Are there any alternative methods to override CSS besides using !important or adjusting the specificity of the element?

I'm currently working on styling a webpage and facing a challenge. I am limited to editing only the CSS file without being able to touch the HTML code. Despite using !important and specificity, I am struggling to override some existing styles. How can ...