在预定义的屏幕宽度上显示和隐藏固定元素

时间:2019-05-31 07:32:25

标签: html css

我想在@media(min-width:576px)上隐藏我的元素,并想在@media(min-width: 768px)上显示我的元素,因为我需要为元素使用display: fixed;,但是display: fixed;元素是没有显示我的元素。

@media (min-width : 576px) {
    #content-item { display: none;}
}
@media (min-width : 768px) {
    #content-item { display: fixed;}
}

我希望显示我的#content-item元素,并且还希望使用display:fixed;财产

1 个答案:

答案 0 :(得分:0)

我认为您是在显示和位置之间造成混淆。 试试这个。

class DDQN_Agent():
    """Interacts with and learns from the environment.

    Attributes:
        state_size (int): dimension of each state
        action_size (int): dimension of each action
        seed (int): random seed
    """

    def __init__(self, state_size, action_size, seed, qnet="baseline", filename=None):
        """Initialize an Agent object.

        Args:
            filename: path of .pth file with trained weights
        """
        self.state_size = state_size
        self.action_size = action_size
        self.seed = random.seed(seed)

        # Q-Network
        if qnet=="3hidden":
            self.qnetwork_local = QNet_3hidden(state_size, action_size, seed).to(device)
            self.qnetwork_target = QNet_3hidden(state_size, action_size, seed).to(device)
            self.optimizer = optim.Adam(self.qnetwork_local.parameters(), lr=LR)
        else:
            self.qnetwork_local = QNet_baseline(state_size, action_size, seed).to(device)
            self.qnetwork_target = QNet_baseline(state_size, action_size, seed).to(device)
            self.optimizer = optim.Adam(self.qnetwork_local.parameters(), lr=LR)

        if filename:
            weights = torch.load(filename)
            self.qnetwork_local.load_state_dict(weights)
            self.qnetwork_target.load_state_dict(weights)

        # Replay memory
        self.memory = ReplayBuffer(action_size, BUFFER_SIZE, BATCH_SIZE, seed)
        # Initialize time step (for updating every UPDATE_EVERY steps)
        self.t_step = 0