CSS and setting "display" with media queries - css

So suppose I have the following code:
td.topnav_link {
padding: 5px 5px 5px 5px;
background-color: #5babd7;
border: 1px solid #578baf;
cursor: default;
}
#media screen and (max-width: 500px) {
#id_topnav_link_menu.topnav_link {
display: block;
}
#id_topnav_link_about.topnav_link {
display: hidden;
}
#id_topnav_link_contact.topnav_link {
display: hidden;
}
}
and
<td class="topnav_link" id="id_topnav_link_contact">
contact
</td>
should the "about" and "contact" not become hidden when I resize the browser down? (It does not for me when testing in a variety of browsers)
(Note: Yes, I realize I am using a td where I should not, but I am slowly converting an old layout of mine to be more CSS and more mobile)

There's no hidden value for display. It should be none. But as it is a cell, you should use visibility, which will hide the cell, but the space will still remain there:
#media screen and (max-width: 500px) {
#id_topnav_link_menu.topnav_link {
display: block;
}
#id_topnav_link_about.topnav_link {
visbility: hidden
}
#id_topnav_link_contact.topnav_link {
visbility: hidden
}
}
Here's a list of possible values: https://developer.mozilla.org/en-US/docs/Web/CSS/display

Related

Why doesn't this CSS get scoped by vue.js?

Inside a Vue single file component I have a scoped style section that looks like this:
<style scoped>
#media screen and (max-width: 767px) {
#suggestions, #form, #mapcontainer, #searchcontainer {
width: 100%; padding: 6px;
}
#mapcontainer div#mapx {
height: 400px
}
}
#media screen and (min-width: 768px) {
#workarea {
display: grid;
grid-template-columns: 1.5fr 1fr;
}
#mapcontainer {
grid-column: 1;
}
.blurb {
grid-column: 2;
margin-left: 12px;
}
#mapcontainer div#mapx {
height:600px;
width: 100%;
}
}
#suggestions tr { border-bottom: thin solid silver; }
#suggestions td { padding: 6px 3px 6px 3px }
#suggestions table { margin-bottom: 12px }
</style>
After checking the rendered source in Chrome's inspector I see the data tag in the rendered component like this:
<div data-s-0="" id="appspace">
but I don't see any of the expected changes to the CSS as documented in the section about scoped CSS in the vue.js docs
It seems to happen every time the scoped style contains a #media query.
What do I need to change so that styles stay scoped?

Issues removing elements, not worked correctly

I have removed some elements from a wordpress theme/template, however they have not worked fully
Issue 1: Header on page still contains gray
https://www.bodyclocktherapies.co.uk/?post_type=product
Issue 2: Background image remains on mobile devices and not on desktop
https://www.bodyclocktherapies.co.uk/?post_type=product
Image: https://ibb.co/QdPc7V4
Tried some css code, but has not worked
Issue 1
#cms-theme.woocommerce.archive #cshero-header.header-1 {
background-color: #ffffff;
}
#cshero-header-navigation.col-xs-12.col-sm-12.col-md-12.col-lg-12 {
background-color: #ffffff;
}
a:hover {
background-color: #ffffff;
}
Issue 2
#cms-theme.woocommerce.archive #cms-content {
background-color: #ffffff;
}
#cms-theme.woocommerce.single-product #cms-content {
background-color: #ffffff;
}
#main.site-main {
background-color: #ffffff;
}
I should have a complete white header and clear bacground on all devices
You can simply right click and used inspect element for this.
For First issue used this css:
#cms-theme.woocommerce.archive #cshero-header.header-1 > .container,
#cms-theme.woocommerce-page.archive #cshero-header.header-1 > .container {
background-color: #fff;
}
#cms-theme.woocommerce.archive #cshero-header.header-1,
#cms-theme.woocommerce-page.archive #cshero-header.header-1 {
background-color: #fff;
}
#media (min-width: 993px){
#cshero-header.header-1:before {
background-color: #fff !important;
}
}
For Second issue:
Background image come in after selector so that you need to hide that in mobile using media query
#media (max-width: 767px){
#cms-theme.woocommerce #page:after,
#cms-theme.woocommerce-page #page:after {
display: none
}
}

Bootstrap 3 - navbar collapsible until 990px

I've got this problem. Bootstrap 3 framework changes my navbar into collapsible version (mobile version) when it reaches 767px screen wide. I would like to change it that mobile version exists until 991px. I've seen a similar question but the correct answer is unusable for me. It says that it can be set up while downloading custom version of Bootstrap, putting required value for collapsible navbar. The problem is, I use it with Drupal 7 and the Bootstrap version is provided autamtically form this url: netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.css.
So I have to override this value in my custom css file, but I've know idea what to change - I believe there are many of classes to change. By the way, it might be important, I don't use LESS version.
Regards,
David
You can override it like this..
#media (max-width: 990px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
}
Demo: http://bootply.com/105915

how can i make bootstrap menu responsive anytime?

i want to set my bootstrap navigation as responsive in any width that i want. For example in 1200 pixels width it should act like normal navigation but in 1110 pixels width; i want to set menu to go responsive. I tried to make it with jquery but no response. Is there anyway to do that?
You can override the default Bootstrap navbar toggle threshold using a CSS media query like this..
#media (max-width: 1110px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
}
Demo: http://bootply.com/98488
(this example uses 1280, but you can change it to 1110 to see the navbar collapse)

minimum width(of browser) to display the collpase button of nav bar

Can we set width of browser to display the collapse button of a navigation bar in bootstrap??
I think media queries may help me with this..but i don't know to set min width of browser window
You can use a media query for this. For example, this would make the collapse button toggle at 1280 pixels..
#media (max-width: 1280px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
}
Example on Bootply: http://bootply.com/98488
If you are using bootstrap-3,you can use col
<div class="col-md-8">.col-md-8</div>
for details http://getbootstrap.com/css/
Go to http://getbootstrap.com/customize/ the #grid-float-breakpoint is the last field in this screen shot, there you can enter the breakpoint (#screen-sm-min - 768px, #screen-mid-min - 992px) of where you want the menu to turn into the collapsed version.

Resources