3

I'm trying to put some code of a complete Html page where I've setted inside of a frame. I feel obligated to use put all of this content in a box because the innet text has its own page and its own style.

I'm looking for the way to not to inherit the style from the LayoutPage. I can't reference the page because I need to use the Razor to set some values through the model.

What can I do to override all the styles inside of the frame?

@model Contoso.Core.Exercises.TimesTables.Exercise1

<frame>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Generated by WebWorksheet version 3.5.1 on 31/05/2013 www.webworksheet.com -->
<html><head><meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Times Tables</title>
<script type='text/javascript'>
   var wwsRelease = 'http://webworksheet.com/release/030501';
   var iterations = 3;
   var imageFolder = 'wwsImages';
   var displayZeroes = true;
   var dbConnection = '';
   var dbQueryScript = '';
   var firstInput = 'iB54';
   var datePickerAuto = '';
   var datePickerImg = '';
   var activeBorder = '2px solid black';
   var activeBackground = 'transparent';
   var lastBtnClick = '';
   var protectPage = false;
   var webQueries = new Array();
</script>
<script type='text/javascript' src='http://webworksheet.com/release/030501/webworksheet.js'></script>

<style type='text/css'>
@@media all {
 Body {overflow:auto;}
 A {text-decoration:none; cursor:pointer; color:inherit;}
tereško
  • 58,060
  • 25
  • 98
  • 150
Darf Zon
  • 6,268
  • 20
  • 90
  • 149

4 Answers4

2

Give different styles for the child element for the same css property. Like

.parent {

     background-color: green;

}

.parent .child{

     background-color: red;

}

Community
  • 1
  • 1
Jazmin
  • 616
  • 1
  • 7
  • 21
0

You can use !important; keyword.for example:

text-decoration:none!important;
  • But I'm talking about several CSS and many attributes in it. There's no way to ignore all the style from the parent? – Darf Zon Jul 03 '13 at 04:00
  • http://stackoverflow.com/questions/8002997/override-css-style-of-parent-element-without-affecting-other-elements –  Jul 03 '13 at 04:03
0

If you are using class to give css to that particular tag then you can simply set class name as blank or another class whatever you want to use:

document.getElementById("tagid").className = "";

OR

document.getElementById("tagid").className = "class2";

And If you are able to use JQuery then it is very simple to remove parent class like this:

<script>$("tagid").removeClass("oldclass");</script>

for more details for JQuery click here.

Bhavik Patel
  • 752
  • 1
  • 5
  • 20
0

For me, I couldn't get the class .userLink to be recognized. Then I realized it was under a DIV with id=#nav3, which in the CSS already had a style defined for #div3 a. From Jazmin's answer above, I tried this and it got the class to work again.

#nav3 .userLink 
{
    font-size: 0.8em;
    color: blue;
}
Gene Bo
  • 11,284
  • 8
  • 90
  • 137