Why magnetic flux density is material dependent where as electric flux density is not? Electric flux out of a closed surface depends only on the charge enclosed. So, intuitively, the number of flux lines crossing unit area is constant regardless of the material. However, the number of magnetic flux lines crossing a unit area seems to change from material to material. In other words, more lines are generated inside a magnetic material compared to vacuum. Can you please help me understand this concept? What point I miss/ think wrong ? I tend to believe that the number of lines per unit area should be same in all materials it pass through.
One way I can think of is that flux lines get squeezed in a magnetic material. For the sake of explanation, say, a magnet produced a total 100 flux lines. The magnet is in vacuum but a piece of magnetic material is placed nearby. Without the magnetic material, the flux density at a point is $2\space lines/m^2$. Now when I place the magnetic material, some of the lines outside gets squeezed towards the material and so flux density inside becomes $4 \space lines/m^2$. But this should also reduce the flux density just outside the material. Which would suggest that the flux density depends not only the spatial location of the point from the magnet and the material, but also on the magnetic properties of all the materials that are placed near the magnet.
In other words, if I place a superconductor (that expels magnetic flux - Meissner effect) near to a magnet, then flux density outside of superconductor would increase from its normal value?
 A: Fields, field lines and flux
Electric (and magnetic) field lines are just a visual (or mathematical) construct to visualize fields. The density of field lines at a point indicates the strength of the field and the direction of the field lines at that point gives the direction of the field.
We define flux as the rate of flow of some quantity per unit area. In the case of electric fields, we define electric flux as the amount of electric field (or field lines) going through a unit area. In the case of magnetic fields, we define magnetic flux as the amount of magnetic field (or field lines) passing through a unit area.
Mathematically, they can be stated as follows:
$$\Phi_E = \oint \vec{E}.d\vec{s}$$
$$\Phi_B = \oint \vec{B}.d\vec{s}$$

Coulomb's law
$$\vec{F} = \frac{1}{4\pi \epsilon} \frac{q_1q_2}{r^2} {\hat{r}}$$
where $\epsilon$ is the permittivity of the medium. For vacuum, $\epsilon$ is equal to $\epsilon_0$. Generally, we use the dielectric constant ($\epsilon_r$) to describe a medium's electric properties instead of its permittivity. The dielectric constant is defined as follows:
$$\epsilon_r = \frac{\epsilon}{\epsilon_0} \tag{1}$$
From the above facts, we can conclude that the force between two charges placed inside a dielectric depends on the permittivity of the dielectric.
Calculating the force due to two charges placed inside a dielectric is easy. However, calculating the force between two charges where the line of action is blocked by a dielectric is not that straight forward. Refer to John Rennie's answer to What is the force between two charged objects when the space between them is partially filled by a dielectric medium? to understand how the electric field is affected by dielectrics placed in the line of action (the line joining two charges).

Gauss' Law
$$\nabla.E = \frac{\rho}{\epsilon}$$
$$or$$
$$\Phi_E = \frac{q}{\epsilon}$$
where $\epsilon$ is the permittivity of the material.
The Gauss' Law is a restatement of Coulomb's law. It is no surprise that Gauss' law has the material's permittivity because Coulomb's law is having it. We'll try to derive Coulomb's law from Gauss' law to improve our intuition.
Consider a spherical Gaussian surface of radius $r$ with charge $q$ placed at its center. The electric field due to the charge goes radially outwards on the surface of the sphere and is equal in magnitude at all points on the sphere (points on the sphere are equidistant from the charge; by symmetry, they must be equal in magnitude).
$$\int E.ds = E 4\pi r^2 = \frac{q}{\epsilon}$$
$$E = \frac{1}{4\pi \epsilon} \frac{q}{r^2}$$

Why does the permittivity constant change in a dielectric?
We'll use an example to understand. Consider a circular parallel-plate capacitor with a dielectric as shown in the figure.

Assume that there is no gap between the dielectric and the plates of the capacitor. The gap seen in the picture is for visual aid only.
Let the charge on the capacitor plates be $q$. This charge will induce a charge $q`$. The induced charges are such that the electric field created by the induced charges opposes the electric field due to the capacitor plates.
Consider a Gaussian surface as shown in the figure (blue color cylinder). We will apply Gauss' law in a unique way: neglect effects of the dielectric. Using this way, we will consider the effect of polarization of the dielectric which would have otherwise been neglected if Gauss' Law was applied with the correct constant ($\epsilon$ instead of $\epsilon_0$)
$$\oint E.ds = \frac{q - q`}{\epsilon_0} \tag{2}$$
The electric field due to the capacitor's plates is given by:
$$E = \frac{\sigma}{\epsilon_0} = \frac{1}{\epsilon_0} \frac{q}{A}$$
The electric field due to the dielectric is given by:
$$E` = \frac{\sigma`}{\epsilon_0} = -\frac{1}{\epsilon_0} \frac{q`}{A}$$
The net electric field setup inside the dielectric is given by:
$$E_{net} = E + E` = \frac{1}{\epsilon_0} \frac{q - q`}{A} \tag{3}$$
Let us introduce a new quantity $\epsilon_r$ and define it as follows:
$$E_{net} = \frac{E}{\epsilon_r} = \frac{q}{A\epsilon_0 \epsilon_r} \tag{4}$$
Substituting $E_{net}$ using $(3)$ in $(4)$, you get:
$$\frac{1}{\epsilon_0} \frac{q - q`}{A} = \frac{q}{A\epsilon_0 \epsilon_r}$$
Solving for $q`$, you get:
$$q` = q\left(1 - \frac{1}{\epsilon_r}\right) \tag{5}$$
Substituting $(5)$ in $(2)$, you get:
$$\oint E.ds = \frac{q}{\epsilon_0 \epsilon_r} \tag{6}$$
Whoa! The equation $(6)$ is the Gauss' Law in its general form. The change in electric flux in the presence is caused by the induced charges in the dielectric.
$$$$
Displacement vector $(D)$
Sometimes, while you are deriving an equation or working with a general case, it becomes quite annoying to carry the $\epsilon_r$ term. We have a material independent equivalent of the electric field: displacement vector or electric field density.
It is defined as:
$$D = \epsilon E$$
The Gauss' Law can be expressed in another form using $D$.
$$\oint D.ds = q$$
Integral of the displacement vector flux over a surface is equal to the sum of the charges enclosed by the surface.

Analogy for magnetic flux
A dielectric, in the presence of electric field, builds up charges on the external surface. Similarly, a material gets magnetized in the presence of the magnetic field.

Courtesy: Hyperphysics
A unmagnetized material has its magnetic domains aligned in arbitrary directions. Together, they produce a net zero magnetic moment.
When the unmagnetized material is placed in a magnetic field, the magnetic domains inside the material align in the direction of the magnetic field. This alignment of the domains in the material produces additional magnetic field. Unlike, dielectrics, the newly produced magnetic field reinforces the existing magnetic field.
It is not hard to understand that if a larger magnetic field goes through a unit area, the magnetic flux would also be larger.
