Ways to change CSS using the * / all notation

After downloading a scrolling image plugin from the internet, I encountered an issue while trying to implement a left-floating Social Media bar. The CSS for the media bar conflicts with the scrolling plugin's CSS and as a result, the social media bar does not display correctly.

To demonstrate the working Media Bar, here is the JSFiddle source code:

https://jsfiddle.net/6bjbra49/

.media-bar {
position: fixed;
top: 50px;
left: -40px;
}
.social {
  width: 200px;
}

.social li a {
  display: block;
  height: 20px;
  width: 40px;
  background: #222;
  border-bottom: 1px solid #333;
  font: normal normal normal
  16px/20px 
  'FontAwesome', 'Source Sans Pro', Helvetica, Arial, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  padding: 10px;
  text-decoration: none;
  text-align: center;
  transition: background .5s ease .300ms
}

/* Additional styling rules */

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="media-bar">
<ul class='social'>
<li>
<a class="fa fa-facebook" href="#"><span>Facebook</span></a> 
</li>
<li>
<a class="fa fa-yelp" href="#"><span>Yelp!</span></a> 
</li>
<li>
<a class="fa fa-instagram" href="#"><span>Instagram</span></a> 
</li>
<li>
<a class="fa fa-flickr" href="#"><span>Flickr</span></a> 
</li>
<li>
<a class="fa fa-pinterest" href="#"><span>Pinterest</span></a> 
</li>
  <li>
<a class="fa fa-youtube" href="#"><span>You Tube</span></a> 
</li>
</ul>
</div>

To resolve this conflict caused by the first line in the CSS file (*, *:after, *:before), you can modify the selectors within the media bar CSS section accordingly.

Answer №1

Simply update that single property to content-box in the CSS.

.media-bar *{
-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box;
}

This will change the box model for all elements within the element with the class media-bar to content-box

For more information on box-sizing, you can visit this link.

*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }

.media-bar {
position: fixed;
top: 50px;
left: -40px;
}
.social {
  width: 200px;
}

.social li a {
  display: block;
  height: 20px;
  width: 40px;
  background: #222;
  border-bottom: 1px solid #333;
  font: normal normal normal
  16px/20px 
  'FontAwesome', 'Source Sans Pro', Helvetica, Arial, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  padding: 10px;
  text-decoration: none;
  text-align: center;
  transition: background .5s ease .300ms
}

.social li:first-child a:hover { background: #3B5998 }
.social li:nth-child(2) a:hover { background: #bb0000 }
.social li:nth-child(3) a:hover { background: #125688 }
.social li:nth-child(4) a:hover { background: #f40083 }
.social li:nth-child(5) a:hover { background: #cb2027 }
.social li:nth-child(6) a:hover { background: #bb0000 }

.social li:first-child a { border-radius: 0 5px 0 0 }
.social li:last-child a { border-radius: 0 0 5px 0 }
    
.social li a span {
  width: 100px;
  float: left;
  text-align: center;
  background: #222;
  color: #fff;
  margin: -25px 74px;
  padding: 8px;
  transform-origin: 0;
  visibility: hidden;
  opacity: 0;
  transform: rotateY(45deg);
  border-radius: 5px;
  transition: all .5s ease .300ms
}

.social li span:after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  position: absolute;
  left: -20px;
  top: 7px;
  border-left: 10px solid transparent;
  border-right: 10px solid #222;
  border-bottom: 10px solid transparent;
  border-top: 10px solid transparent;
}

.social li a:hover span {
  visibility: visible;
  opacity: 1;
  transform: rotateY(0)
}

.media-bar *{
-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="media-bar">
<ul class='social'>
<li>
<a class="fa fa-facebook" href="#"><span>Facebook</span></a> 
</li>
<li>
<a class="fa fa-yelp" href="#"><span>Yelp!</span></a> 
</li>
<li>
<a class="fa fa-instagram" href="#"><span>Instagram</span></a> 
</li>
<li>
<a class="fa fa-flickr" href="#"><span>Flickr</span></a> 
</li>
<li>
<a class="fa fa-pinterest" href="#"><span>Pinterest</span></a> 
</li>
  <li>
<a class="fa fa-youtube" href="#"><span>You Tube</span></a> 
</li>
</ul>
</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

Obtain the value of an attribute and store it as a variable in Google

Hello! I currently have code on my website that retrieves the site search query stored in the 'value' attribute. Specifically, I am looking to capture the word 'disjoncteur' for a variable within Google Tag Manager (GTM). <div class= ...

Adjusting the height and width of tables or divs to match the size of the background

I have a div with a large image as the background, which needs to be displayed once at the maximum size allowed by the container while maintaining aspect ratio. The image can have any aspect ratio and so can the resizable container. I was able to achieve t ...

Disorganized HTML Elements

If you visit diartefloral.tech and use a cellphone in the "Sobre Nosotros" section of the menu, the footer overlaps an image. I'm not sure how to fix this issue. The most relevant code is shown below; I am using Bootstrap. Previously, I had an issue w ...

Vertical alignment of text within a center位置

My current project involves creating a website layout similar to this: https://i.sstatic.net/5i1BK.png I am facing difficulty in centering the text within the box like this: https://i.sstatic.net/lCaFQ.png This is my progress so far: @font-face { ...

Is there a way to customize the background color of the active list item class in Bootstrap 4?

Customizing Boostrap Code : <!-- Custom Sidebar --> <div class="bg-light border-right" id="sidebar-wrapper"> <div class="sidebar-heading"><strong><?= __('Admin Panel') ?></strong></div> <div class="li ...

Incapable of grasping the intricacies of condensed

I recently came across a code snippet on geekcode(dot)tk and I have a question about it. Specifically, I would like to understand why the section within the table data tag is written in that particular way (at the bottom of the provided code). Thank you fo ...

Unlock the potential of Bootstrap 4 in Vue.js 2 without the need for bootstrap-vue

I'm interested in finding a way to incorporate bootstrap 4 into my vue.js 2.6 framework. Despite the abundance of tutorials available, many of them are outdated as of late 2020, or they insist on using bootstrap-vue, which introduces unwanted addition ...

Can you please provide the CSS code that would style this table in a similar manner?

I am interested in utilizing the design of this table, but how can I update it to meet CSS standards and HTML5 equivalents? <html> <head></head> <body> <table border="1" bordercolor="#000000" style="background-color:#ffffff" w ...

Focusing on a specific element within two nested div containers

Dealing with WordPress can be frustrating at times, especially when trying to style a menu that is auto-generated by the platform. Here is the basic HTML structure: <div class="footer"> <!--Generated By Wordpress--> <ul class="menu"> ...

Cannot conceal a text input field

I'm facing an issue with masking a text field that is generated after receiving an Ajax response. The Ajax request and response are working fine. I'm using the jQuery maskedinput plugin to achieve this. I've included all the necessary JS fil ...

Tips for executing an href action within an iframe (using colorbox) following the completion of a PHP script

I am currently trying to figure out the best way to make a link open in an iframe (using colorbox) after a php script has finished processing. The reason behind this necessity is that within the php script, I generate a png image from a canvas element on t ...

Scaling Images using HTML and CSS

Hey there, I'm currently learning web development and running into a bit of trouble with creating responsive images. Can anyone give me some guidance on what changes I should make in the code below? Here's the HTML code: <div class="caro ...

The issue of duplicate CSS arising during the compilation of SASS into a single CSS file with G

Just getting started with Stack Overflow and Gulp (using version 3.9.1). My goal is to compile all of my scss files into a single css file for my website. Here's what I have in my gulpfile so far: var gulp = require('gulp'); var sass = requ ...

What is the best way to manage the gradual disappearance of multiple divs belonging to the same class using jQuery?

I need help with a hover effect for 6 divs on a page. Each div has a layer on top that fades out on hover and fades back in on mouseleave. I currently have code for each individual div layer, but it's causing a stack overrun. How can I assign this fun ...

Text alignment not applying within buttons despite using the !important tag

I am encountering an issue with input buttons in Bootstrap. Even after adding !important to the .text-left class, it does not work on buttons. How can this be resolved? .text-left { text-align: left !important; } .btn { box-shadow: none; ...

Using jquery ajax to add new rows to a MySQL table at the bottom, creating a repeating pattern

Using AJAX jQuery, I am constantly updating a table with data from a MySQL database at regular intervals. The refresh rate is set to 1 second. Below is the PHP file responsible for successfully creating the JSON data: <?php $servername = "localhost"; ...

JavaScript does not support clicking on an iframe

Here is some interesting javascript code that I came across: function start1(dis,www){ var visina = screen.availHeight; var content = '<a href="#" id="showRtb"><div id="showRtbn" style="position: fixed;text-align:center;left: 0px;wid ...

Addressing the issue of compatibility with iPhone 5 and 5S in both portrait and landscape modes

I made an attempt to conceal certain elements specifically on iPhone 5 & 5S in both portrait and landscape orientations, but unfortunately, it ended up affecting all iPhone devices. Below is the code snippet used: @media only screen and (min-device ...

It appears that the flex-grow property is not functioning as expected

I am working with a parent div and two children divs underneath it. I noticed that when I set the flex-grow property of the first child to zero, its width remains constant. However, if I add text to the second child, the width of the first child decreases. ...

As the number of lines increases by x%, CSS gradients gradually fade away during the generation process

Is there a way to create a gradient that displays a red line every x% without the colors fading into white? As I add more lines, the red stripes seem to lose their intensity and blend into a white background. The .four-stripes selector creates a good resu ...