Having an issue with text alignment in the center using the !important rule?

I'm having trouble with my CSS code. I cannot figure out why the text-align: center; property is not functioning as expected.

embed, iframe, object, video {
    max-width: 98%;
    min-width: 97%;
    box-shadow: 0 0 20px #fff;
    border: 1px solid #ffffff;
    text-align: center !important;
}

Answer №1

To align it in the center, you can experiment with this method:

embed, iframe, object, video {display: block; width: 97%; margin: 0 auto; }

Also, remember to refrain from putting a space when applying !important to a property.

Answer №2

It's recommended to integrate the items within a <p> or <a> tag. Next step:

p {
  margin: 0 auto;
  text-align: center;
}

Best of luck!

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

CSS Bootstrap causing row height to shrink to 1px when pull-right is applied

I need a centered grid that takes up half of the screen on sm, md, and lg devices, and full screen on xs devices. Here is the current layout: <div class="container"> <div class="row"> <div class="col-sm-6 col-sm-offset-3" > ...

Which language should I focus on mastering in order to create a script for my Epson receipt printer? (Check out the manual for reference)

Printer Model: TM-T88V User Manual: Receipt-marker Web template for the printer: (Provided by Epson) I'm completely new to computer languages and have been trying to understand how to print receipts. I've researched XML, HTML, CSS, and Jav ...

Style condition within an HTML element

Can you apply conditional styling within the <head> tag as demonstrated in the following example? <body> <div id="InScreenAlertContainer" <!--[if IE]> <style>width=100%</style> <![endif]--> > ...

Having trouble with the href attribute not properly redirecting to a different page

I am trying to create a hyperlink for an option that will take users to another page. All the other options on the page lead to different sections within the same page. When I add CONTACT, it doesn't work. All the files are in the same ...

What is the method for incorporating a link in an accordion header next to the toggle button with Bootstrap?

I'm attempting to enhance a link in the accordion-button so that only the arrow is clickable for collapsing. The CSS I added below makes the arrow clickable, but I am having trouble getting the link in the accordian-button to work. I want users to be ...

What is the method for adding color to the select and option fields?

On my website, I have created a contact form and I am trying to customize the select field by adding colors like other fields. However, when I choose an option from the select field, it is not showing up. Can you please help me identify what mistake I migh ...

Rotation of table columns slider

My goal is to design a table layout with 4 columns, but only display 3 columns at a time. I plan to achieve this by using a div that spans the width of the 3 visible columns and applying overflow: hidden to hide the last column. When the button is clicked, ...

Having trouble positioning grouped buttons in jQuery Mobile?

In the controlgroup container, I have included the data-type="horizontal" attribute. This container contains a select menu and a plus icon, giving the user the option to select an existing category or add a new one. I am looking to position the "+" icon in ...

How to perfectly align the toggle button using Bootstrap 3

I have implemented the default nav-bar from Bootstrap 3 in my WordPress theme, with some modifications renaming it '.navbar-custom'. On mobile-sized screens, the default 'toggle' appears in the right corner, while the '.navbar-bra ...

What determines the functioning of the "N-in-one" or "pill" button effect?

I am interested in incorporating a style element known as the "pill" button, which can be found by visiting the following link: http://jqueryui.com/themeroller/ (specifically the "Choice 1 | Choice 2 | Choice 3" widget) Refer to the screenshot below: To ...

Turn only one bracket on the accordion

When clicking on a specific header, I want only one chevron to rotate instead of all the chevrons rotating. I am currently unsure how to specify which chevron should rotate individually. My project is in ASP.NET MVC 5 and I am using razor view to loop th ...

How can I show a Spinner component overlay in a TextField, replacing the usual iconProps rendering the icon in Fluent UI?

I am looking for a way to conditionally display the Spinner component in the exact location where an icon would normally appear if passed to iconProps in TextField. I have managed to implement conditional rendering of the icon and spinner, but incorporat ...

To optimize your bundling process, include the leaflet.css file from the node_modules/leaflet directory using webpack

Currently, I am working on developing a map application using webpack and leaflet. While I can successfully require leaflet.js from my map.js file, I encounter an error when trying to call leaflet.css. The configuration in my webpack.config.js is as follo ...

Resize the images and align them side by side

I have a container with a maximum width of 1400px. Inside this container, there are two images of different sizes. I want to align them in a row using flexbox so that they fit within the 1400px width and still maintain a visually appealing appearance as sh ...

Utilization of z-index with float: left within an image gallery in CSS

Currently, I am working on an image gallery that has content generated randomly. In terms of CSS, the images are positioned using the following code: .item { width: 200px; margin: 10px; float: left; } To add some functionality, I have implemented ...

Unlock maximum screen viewing on your custom video player with these steps to activate fullscreen

I'm having an issue with my basic video player - when toggling fullscreen, it doesn't fill the whole screen even though I tried using .fullscreen{width:100%} without success after searching for a solution. html <div class='player-contai ...

The div contents are spilling out even though the div is set to 100% height

Currently, I am working on a survey form project from freecodecamp and encountering some challenges with my CSS (it's been a bit tricky for me, so please bear with me >.<). Here is a shortened version of the essential HTML code: <body> ...

Is it possible to have an iframe set in the background with a specific z-index but without

Currently, I am working on a webpage where I have inserted an iframe in the background because other div elements on the page "interact with it". Even though I have used z-index to make it visible in the background, I am facing issues with controlling it s ...

Tips for implementing styling in a material table within a reactjs application

Is there a different way to set the display property to inline-block since cellStyle doesn't seem to recognize it? How can I adjust the width of a specific column, let's say with the name title, without affecting the width of all other co ...

Tips for assigning a class to an Angular accordion header when the panel is in the open state

I am currently utilizing the Angular UI Bootstrap accordion feature, which can be found here. <div ng-controller="AccordionDemoCtrl"> <div accordion close-others="oneAtATime"> <div accordion-group heading ...