Adjust the width of the media player object according to the browser being used

In my asp.net web application, I have a media player object that displays differently in Chrome, Firefox (as VLC player) and IE (as Windows Media Player). This results in varying width of the embedded audio player object. How can I adjust the width of the media player for different browsers using CSS?

Below is the Audio Player Code:

<div CssClass="media_player">
            <object name="MMPlayer1" id="MMPlayer1" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
                height="68" width="680" standby="Loading Media Player components..." type="application/x-oleobject"
                codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=6,4,7,1112">
                <param name="fileName" value="ding.wav">
                <param name="autoStart" value="false">
                <param name="showControls" value="true">
                <param name="AllowChangeDisplaySize" value="false">
                <param name="ClickToPlay" value="true">
                <param name="ShowDisplay" value="0">
                <param name="ShowDisplay" value="false">
                <param name="ShowStatusBar" value="1" />
                <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
                    src="http://localhost:50451/ding.wav" autostart="false" width="680" height="68">
                </embed>
            </object>
        </div>

CSS:

    .media_player
{
    margin-left:0;
    margin-top:0;
    width:680px;
    height:70px;
    background-color:White;
}

Answer №1

To customize your CSS for different web browsers, consider using specific browser selectors in your HTML header. By utilizing resources like this website, you can achieve the desired effect:

<style type="text/css>
    /* Default */
    .video_player {
        width:500px;
    }
    /* Firefox */
    body:last-child .video_player, x:-moz-any-link {
        width:600px;
    }
    /* Chrome (and Safari) */
    .video_player:not(*:root) {
        width:700px;
    }
</style>
<!--[if IE]><style type="text/css">
    /* Internet Explorer */
    .video_player {
        width:800px;
    }
</style><![endif]-->

For comprehensive browser compatibility, it's recommended to incorporate all major browsers. You can achieve this by using a JavaScript plugin such as this tool.

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

Accessing the IDs of unordered list controls in codebehind

I am working with ul elements in a user control as shown below: <u><ul> <li id="liMiddle" class="off"> <a href="#">One </a> <ul id="One" runat="server"> ...

Why does the "margin" CSS style fail to function properly in FlowPanel within GWT?

I'm currently working with Gwt and have encountered a problem with styling buttons. Let's take a look at the following code snippet: .marginRight{ margin-right: 10px; } FlowPanel myFP=new FlowPanel(); Button myButton=new Button("Button"); Butt ...

What steps should be followed to modify a user's password?

Is there a way to update the user password for an active user, as well as any field in their profile, with a Silverlight Business Application? ...

Tips for splitting words in a responsive Bootstrap table

Here is the code snippet I am struggling with: <table id="table" class="dataTable table table-hover table-md table-responsive" cellspacing="0" role="grid"> <thead> <tr> ...

Getting the values from an array contained in a session object

In my C# class, I am working with a session object that holds an ArrayList type of data. What is the best approach to retrieve the array stored within the session object? If we refer to the visual representation provided below, how should I access the val ...

Using JQuery functions from other JavaScript files is Simple

When it comes to my CSS, I have taken the approach of creating smaller files for specific functions and then using minification to merge and compress them into one file for easier download. I want to apply the same strategy to my JS Files by logically sep ...

Implementing a button on a polygon shape within an SVG

I have an SVG at the bottom and I would like to place a button on the bottom line that is also responsive. How can I achieve this using CSS? What I am trying to accomplish: Example Image Is it possible with just CSS and how should I go about implementin ...

What are some ways to utilize MEF AssemblyCatalogs in conjunction with unique AssemblyLoadContexts?

I've been developing an ASP.NET Core API that supports Plug-Ins for extensibility. To ensure that the Plug-In Assemblies can be unloaded, I have implemented a system where they are loaded into separate and collectible AssemblyLoadContexts. This is ho ...

Encountering Issues Rendering DataTable in ReportViewer Using aspx.net

I'm struggling to showcase the contents of a DataTable object in a ReportViewer control. Despite no errors, the report viewer displays a blank page. I've explored solutions from various similar questions linked here, here, and here. The last link ...

What is the best way to send information to jQuery from an ASP.NET page?

There seems to be an abundance of resources discussing how to post data from jQuery to an ASP.NET page with AJAX, but I have not come across any for the reverse scenario. Can someone enlighten me on how to invoke a jQuery method from an ASP.NET page? ...

Is it possible to capture the child element's id?

After loading several images onto the page, I hide them using 'display:none': <div id="cont-img"> <img class="lista-img" src="list/1.png" id="v1" /> <img class="lista-img" src="list/2.png" id="v2" /> <img class=" ...

Conceal the div upon clicking outside its boundaries

CSS #apDiv1 { position:absolute; left:863px; top:201px; width:59px; height:47px; z-index:1; } #btftopbar { height:30px; width:auto; background: #005094 url('..'); backg ...

Tips for creating an editable div that can also incorporate a textarea and the option to upload or delete photos

On my website, users can upload images, names, and descriptions which are saved in a MySQL database. The information is then fetched to display on the website. The code below allows users to enter this information and see it displayed when they click the s ...

What is the best way to align the bottom of an element with the browser buttons panel on mobile devices?

When viewing the website on a mobile device, I noticed that the floating button is hidden behind the browser buttons panel. Is there a way to adjust the positioning of the element relative to the browser's buttons panel? I attempted using env(safe-ar ...

Is there a way to utilize the reset() function within an input form?

Is there a way to automatically reset the textbox when submitting a value? Below is my code: <!DOCTYPE html> <html> <body> <ul id="myList"> </ul> <input type="text" id="myText" value="&q ...

Regular expression for matching a CSS definition that includes a specific name and value

Looking to match all CSS definitions with the name "test" and color set to gray? Here are a few examples: a.test { color: grey; } or .test { color: grey; }, as well as a.test:after, a.test { font-size: 10px; color: gray; } It's important to consider ...

Is it possible to move my Home button to the upper left corner of the header using CSS?

`<header> <img src="images/chefs-hat.png"> <p>Popular Recipes</p> <button class="home"> <a href="index.html">Home</a> </button> </header> .home { width: 100px; text-decorati ...

Chrome is not storing the CSS file in its cache memory. However, it is successfully caching .js and .png

I have noticed that the CSS file is not being cached in the Chrome browser. My application is created using Angular-CLI and all the necessary cache-control headers are set, with an Expires header of 5 minutes: Accept-Ranges:bytes Cache-Control:max-age=600 ...

Ensure that a child div is displayed above the parent div that is absolutely positioned

Is it possible to have a child div within an absolutely positioned parent div appear above its parent, aligned in such a way that the top of the child div aligns with the bottom of the parent div, while also being displayed above neighboring parent divs on ...

Unable to horizontally center ul element within Materialize navigation content

Struggling to center nav-content by using the center option Hoping for it to have this appearance. Unfortunately, applying it directly to the ul attribute doesn't yield desired results. Instead, it ends up looking like this. This is the code snipp ...