WordPress allows for static nested elements to be placed within a page, creating a

For a simple example, you can check out this link -> here

#contactContainer {
background-color: #999;
float: left;
font-weight:900;
text-align:center;
margin: 0 auto;
}

.contactLeft {
position:relative;
margin:auto;
background-color:lime;
float: left;
margin: 0 0 0 0;
width: 230px;
border-left: thick solid #006;
padding-left: 33px;
height: 100px;
}

.contactRight {
position:relative;
margin:auto;
background-color:yellow;
text-align:right;
float: left;
width: 230px;
border-right: thick solid #006; 
padding-right: 33px;
padding-top: 10px;
height: 90px;
}

This year, I am using the twentyfourteen standard theme. My goal is to make two boxes on my contact page responsive so that when the screen is minimized, box B falls under A as shown in the fiddle mockup. While attempting to achieve this, I have tried nesting 2 classes inside of an ID, but ended up using three IDs in the example instead.

After embedding the CSS within the Wordpress page, only the first Div gets recognized.

The purpose of these boxes is to display address information in the left div and contact details in the right. Interestingly, this stacking functionality works perfectly in my example, but not within Wordpress. Any ideas why?

Answer №1

After some trial and error, I finally cracked the code on this one. It turns out that CSS can be included within a page by loading static strings into the dashboard. However, I discovered that it only works when there are no empty spaces between classes and IDs. This detail may seem insignificant in other CSS files I've worked with, but it took me quite some time to figure it out.

Here is the correct formatting:

<style type="text/css">
#contactContainer {
background-color: #999;
float: left;
font-weight:900;
text-align:center;
margin: 0 auto;
}                      <---------NO SPACE
.contactLeft {
width: 230px;
border-left: thick solid #006;
padding-left: 33px;
height: 100px;
}                         <---------NO SPACE
.contactRight {
text-align:right;
float: left;
width: 230px;
border-right: thick solid #006; 
padding-right: 33px;
padding-top: 10px;
height: 90px;
}
</style>

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

html issue with the footer

Just starting out with HTML and encountering some difficulties with adding a footer. The main issue is that when I add the footer, the 'form' element gets stretched all the way down until it reaches the footer - you can see an example of this her ...

Why doesn't the div click event trigger when the mouse hovers over an iframe?

My dilemma involves a div element with a click event. When the div is positioned over an iframe area (closer to the user than the iframe), the click event fails to trigger. However, if the div is located elsewhere and not above the iframe, the click event ...

Tips for utilizing ion view within an ionic 2 application

In my original use of Ionic 1, I placed the footer after the <ion-content> and before . However, in the new Ionic 2, I can't seem to find any reference to <ion-view>. My specific need is to have two buttons at the bottom of the screen fol ...

Fading colored images and backgrounds using Javascript

Although js and html are not my strong points, I am attempting to create two simple effects on a single page. As the user scrolls down the page, I want the background image or color to change as different divs come into view and then move off the screen. ...

Hide the menu even if the user clicks outside of it or anywhere on the webpage

I have a menubar code that is functioning correctly. However, I would like to make an enhancement. Currently, when I click outside of the menubar, it does not hide or close. I want the menubar to be hidden when I click anywhere on the webpage while the men ...

Change the toolbar's background color to a solid white, with no gradiation

CKEDITOR.replace( 'editor_1', { toolbar: [ { ..... }, ], uiColor: 'white', }); Unfortunately, the above code does not yield the desired outcome. .cke_top{background-color: white;} It appears that the specified CSS ...

What are the steps to apply material-ui's error-themed style (color) to non-form text?

When it comes to using error styles for form inputs like text fields, the documentation is straightforward. But what about applying the same style to a custom element, such as a text label for a file upload button or another unique component that doesn&apo ...

Assistance needed with PHP for WordPress

Hey there, I could really use some assistance with this PHP script. I'm still pretty new to PHP and I'm struggling to get this code functioning properly. $current = $post->ID; $parent = $post->post_parent; $grandparent_get = get_post($pare ...

Challenges encountered when converting Javascript into a Django template

I am facing a challenge with converting an HTML file into a Django template. It appears that the main.js file is not functioning properly, yet there are no errors being displayed in the debug console. I recently transferred the files from my local filesys ...

The compatibility issue between Jquery highlight and show more/less function is causing them to malfunction when used

I am facing an issue where, while trying to search for a specific word to highlight it, the "show more" button closes and only displays the text prior to clicking the button. How can I ensure that the expanded content remains open while searching for a wor ...

Reorganize Material UI Grid Items with varying lengths

I'm currently working with a Material UI grid system that appears as shown below: <> <Typography gutterBottom variant='h6'> Add New User{' '} </Typography> <Grid container spacing={3} ...

Creating dynamic forms and tables on an HTML webpage

I'm struggling to dynamically add table elements and form elements in an HTML page. My goal is to automatically add input boxes with labels when a user enters a number in the input box without having to click any button. I believe using the 'keyu ...

Turn on and off scrolling of DIV content when hovering over it

How can I create a div that automatically scrolls to the bottom on hover? I tried implementing the code below, but it doesn't work as expected. It jumps to the bottom of the div's height on first hover and transitions smoothly on second hover. . ...

In my PHP loop, I am creating radio buttons and I only want one of them to be selected at a time

How can I ensure that only one radio button is selected out of the 99 radio buttons generated in this for loop? for($x = 2; $x <= 101; $x++){ $out .= "<img src='/img/channel_icons/".$icons[$x]."' class='ch ...

What is the best way to ensure that the width is determined by the input provided?

I'm currently utilizing the jQuerytokenInput plugin and have an input field with a fixed width. The CSS for the input field is as shown below: li.token-input-input-token-mac input { width: 100px; padding: 3px; margin: 0; border: none; } Whil ...

Staggered Drop-Down Menus

I've created a custom CSS drop-down menu that works well, but I've realized that updating this menu across all the HTML pages on my website would be a tedious task. If I ever need to add a new section and tier to the menu, I'd have to update ...

Display a button with an icon only when in responsive mode using HTML, CSS, and Materialize

Is there a way to hide the text on a button but keep the icon visible when viewing on a mobile device? For instance, if a button displays a face icon from MaterializeCSS along with the text "support", I would like to eliminate the text while still showing ...

CSS rotation causing issues with absolute positioning

In the example below, I have demonstrated the current behavior I am experiencing and the desired outcome. // Rotated div rotated.style.left = "50px"; rotated.style.top = "100px"; // Original "untouched" div original.style.left = "50px"; original.style.t ...

The functionality of filtering a list based on the selected value from a drop-down menu is malfunctioning

When the page initially loads, there is a dropdown with the default placeholder "Select Person Type" and a checkbox list displaying all persons by default. An angular filter is used to display only the selected type of persons from the dropdown (working p ...

How may I utilize CSS to generate a dynamically resizing rotated triangle that adjusts based on the text content?

Looking to add a dynamic badge in the top left corner of a div that adjusts its size based on the text content. Check out this example: http://jsfiddle.net/sbick/npxaasht/ <article> <div class="triangle"> <span>NEW</span ...