What steps should I take to successfully implement a div ID selector in an HTML document?

<div id="nofries">
  <h1 class="restaurant mt-5 ms-3">CRAZY GREEKS</h1>
  <h3 class="ms-5">GREEK FOOD, SUBS &amp; PIZZA</h3>
</div>

I'm having trouble with my div ID "nofries" not being recognized by the CSS. I've tried using it as a class, specifying it as "div.nofries", but nothing seems to work. Any suggestions?

@media only screen and (max-width: 900px) {
    div#nofries {
        display: contents !important;
        text-shadow: -3px 2px 2px rgba(0, 0, 0, 0.63);
        margin: auto;
    }
}

Could my use of Bootstrap be causing interference with the styling? I find Bootstrap's media queries confusing, so I prefer this method. Any insights on this?

Answer №1

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Simple HTML Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  
 
  <style>
   
.table-row{
display: flex;
background:#ccc;
padding:10px;
}
</style>
</head>
<body>

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Simple HTML Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  
 
  <style>
 @media  screen and (max-width: 900px) {
    div#no-fries {
        display: contents !important;
        text-shadow: -3px 2px 2px rgba(0, 0, 0, 0.63);
        margin: auto;
    }
}
</style>
</head>
<body>
<div id="no-fries">
  <h1 class="restaurant mt-5 ms-3">YUMMY DELIGHTS</h1>
  <h3 class="ms-5">TASTY TREATS AWAITS YOU</h3>
</div>

</body>
</html>


</body>
</html>

Answer №2

If you want to give it a go, use the following declaration:

#nofries {
        display: contents !important;
        text-shadow: -3px 2px 2px rgba(0, 0, 0, 0.63);
        margin: auto;
    }
}

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

Using Android to Load HTML Content from a Database and Display in a WebView

I am currently facing an issue with loading HTML content from my sqlite database into a webview successfully. The HTML renders beautifully, however, the local file included in the HTML is not being loaded. I have placed it in the assets folder under this s ...

How can I take a screenshot from the client side and save it on the server side using PHP?

Currently, I am exploring the possibility of screen capturing at the client side. It appears that the "imagegrabscreen()" function can only capture screens on the server side. After some research, I discovered a new function that allows for screen capture ...

I am looking to modify the anchor link and image source using JQuery based on the specific div ID

Looking to update the link of an anchor and source of an image inside this div when clicking on the FR button. I need help figuring out how to do this with JQuery. Here's the code: <div id="my_id"> <a href="wwww.google.com&qu ...

Express.js problem: Unable to load CSS and JS files from the 'public' directory

Currently, I am working on a web project with Express.js and encountering difficulties in loading CSS and JavaScript files from the 'public' folder. Despite following common practices, it seems that something is amiss. Here is the layout of my pr ...

What is the best way to target specific text within the DOM without including text within attributes?

We are currently displaying search results from various posts on our website, and we would like to highlight the search terms in the displayed content. Currently, we are implementing this functionality on the backend using PHP. We iterate through the post ...

Retrieving specific value from a Parent Controller in AngularJS using UI Router

I have a request to display the value stored in $scope.resAVal on my index.html page. This value is accessible within the RootCtrl. index.html <!DOCTYPE html> <html ng-app="plunker"> <head> <!-- any required JavaScript librarie ...

Copy values of multiple input fields to clipboard on click

I have a collection of buttons in my Library, each with different text that I want to copy when clicked function copyTextToClipboard(id) { var textElement = document.getElementById(id); textElement.select(); navigator.clipboard.writeText(textElement. ...

Angular 14: Enhance Your User Experience with Dynamic Angular Material Table Row Management

My inquiry: I have encountered an issue with the Angular material table. After installing and setting up my first table, I created a function to delete the last row. However, the table is not refreshing as expected. It only updates when I make a site chang ...

My form does not receive the Bootstrap classes when using the jQuery script

**Why isn't my jQuery script coloring the rows as expected when certain conditions are met (I italicized the specific part of the code)?** Here is the HTML CODE for the POLL: <form id="pollForm" class="mb-4"> <d ...

I am interested in incorporating various forms within this code

I followed an online tutorial to create this code, and I've made some edits myself, mainly related to the buttons that display information. However, I'm still learning and struggling with adding different forms to each section. I would really app ...

Within a <div> element, there is a <span> element with a border and a specific line height. The

Can anyone explain why the border of the span is positioned next to the top? When I remove the display property for the span, it seems to work fine. Thank you. div { height: 80px; border: 1px solid green; line-height: 80px } .inner-span { heigh ...

Navigating through each segment

I'm currently working on a website with sections that are set to be 100% height of the window, but at least 800px tall. My goal is to implement a smooth scrolling functionality where one scroll moves the view from section to section. However, if the ...

Safari's compatibility issues with Next.js Images are preventing Flexbox from working properly

I'm trying to lay out Next.js Images using flex-wrap with a fixed height but variable width based on the image. I'm utilizing tailwind for this project. Everything is working perfectly on Google Chrome as expected. https://i.sstatic.net/KTTx9.j ...

Differences between -webkit- and -moz-transition

My website uses CSS3 transitions and I have noticed that the -webkit- prefix works, but the -moz- prefix does not seem to be working. This is the CSS code I am using: article {z-index: 2; float: left; overflow: hidden; position: relative; -webkit-transit ...

Sorry, unable to access fullcalendar as the page appears to be blank

I followed all the instructions on the Basic Usage page and included the CDNs as directed, but I am unable to view the basic display. I also tested a jsFiddle example. I am completely new to this. <html> <head> < ...

Executing the SQL query more than once is not permitted

I seem to be facing a challenge in executing SQL queries multiple times. In the given code snippet, the first SQL query 【SELECT h.title, h.place, h.introduction ~】works fine. However, the second one 【SELECT name ~】fails to execute. If I comment ...

Horizontal Scrolling Menu for Dynamic Page Navigation

My goal was to create a smooth-scrolling one-page website that scrolls horizontally. One feature I wanted was a menu that smoothly slides into view whenever a new page is in focus along with the horizontal scrolling. I found an example of a scrolling scr ...

Animation transitioning from one page to another

I'm working on a simple jQuery click and scrollTo anchor script. On another page, I'm linking content using URLs like index.php#home, index.php#about, and so on... Is there a way to achieve the scrollTo effect from an external page? One idea I h ...

Is there a way in Jquery to remove a class?

I have created a code for a single page website where clicking on the toggle bar will display the 'ul' and clicking on one of the 'a' links will take me to the corresponding div. I want the toggle bar to automatically close back after c ...

What is the best way to dynamically adjust the top CSS of an element when it is positioned at the top or

Is there a way to dynamically set the top CSS when an element is over the top or bottom of a page? First, hover over the first cat image. It's working fine. http://image.ohozaa.com/i/480/7YpWei.jpg When I scroll the page to the bottom and hover ove ...